Files
point_of_sale/PointOfSale/Utilities/ESCPOS_NET/Extensions/TaskExtensions.cs
Bjarne Pedersen 41e23b6184 Initial commit
Initial commit til Git.
V2 er deployed
2026-06-13 17:31:50 +02:00

25 lines
670 B
C#

using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
namespace ESCPOS_NET.Extensions
{
public static class TaskExtensions
{
public static void LogExceptions(this Task task)
{
task.ContinueWith(t =>
{
var aggException = t.Exception.Flatten();
foreach (var exception in aggException.InnerExceptions)
{
Logging.Logger?.LogError(exception, "Uncaught Thread Exception.");
}
},
TaskContinuationOptions.OnlyOnFaulted);
}
}
}