mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-18 16:41:36 -07:00
21 lines
636 B
C#
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);
|
|
}
|
|
}
|
|
}
|