mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
22 lines
464 B
C#
22 lines
464 B
C#
|
using System;
|
|||
|
using System.Threading.Tasks;
|
|||
|
|
|||
|
namespace Wabbajack
|
|||
|
{
|
|||
|
public static class TaskExt
|
|||
|
{
|
|||
|
public static async void FireAndForget(this Task task, Action<Exception> onException = null)
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
await task.ConfigureAwait(false);
|
|||
|
}
|
|||
|
catch (Exception ex)
|
|||
|
when (onException != null)
|
|||
|
{
|
|||
|
onException(ex);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|