wabbajack/Wabbajack.Common/Extensions/TaskExt.cs

22 lines
464 B
C#
Raw Normal View History

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);
}
}
}
}