mirror of
https://github.com/bitwarden/android.git
synced 2025-01-06 08:17:34 +03:00
db7ca3b93e
* Abstracted App Center Logging into its own component, so that we can have it centralized in one place and we avoid checking for FDroid on all the places we want to use it * Implemented the new logger where Crashes.TrackError was being used except on some specific cases * Improved logging, added a debug logger and removed AppCenter to be used on DEBUG
28 lines
833 B
C#
28 lines
833 B
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using Bit.Core.Services;
|
|
|
|
namespace Bit.Core.Utilities
|
|
{
|
|
public static class TaskExtensions
|
|
{
|
|
/// <summary>
|
|
/// Fires a task and ignores any exception.
|
|
/// See http://stackoverflow.com/a/22864616/344182
|
|
/// </summary>
|
|
/// <param name="task">The task to be forgotten.</param>
|
|
/// <param name="onException">Action to be called on exception.</param>
|
|
public static async void FireAndForget(this Task task, Action<Exception> onException = null)
|
|
{
|
|
try
|
|
{
|
|
await task.ConfigureAwait(false);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
LoggerHelper.LogEvenIfCantBeResolved(ex);
|
|
onException?.Invoke(ex);
|
|
}
|
|
}
|
|
}
|
|
}
|