bloxstrap/Bloxstrap/Utility/AsyncHelpers.cs
pizzaboxer 102f6d1949
oh so we're back to this huh
hopefully async exception management should be better?
2023-07-26 01:30:00 +01:00

21 lines
636 B
C#

namespace Bloxstrap.Utility
{
public static class AsyncHelpers
{
public static void ExceptionHandler(Task task, object? state)
{
const string LOG_IDENT = "AsyncHelpers::ExceptionHandler";
if (task.Exception is null)
return;
if (state is null)
App.Logger.WriteLine(LOG_IDENT, "An exception occurred while running the task");
else
App.Logger.WriteLine(LOG_IDENT, $"An exception occurred while running the task '{state}'");
App.FinalizeExceptionHandling(task.Exception);
}
}
}