wabbajack/Wabbajack.Common/Extensions/TaskExt.cs
2019-11-05 19:39:18 -06:00

25 lines
536 B
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
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);
}
}
}
}