mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-25 22:59:10 -04:00
Moved source code under src folder - massive change
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using System.Threading.Tasks;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Instrumentation;
|
||||
|
||||
namespace NzbDrone.Common.TPL
|
||||
{
|
||||
public static class TaskExtensions
|
||||
{
|
||||
private static readonly Logger Logger = NzbDroneLogger.GetLogger();
|
||||
|
||||
public static Task LogExceptions(this Task task)
|
||||
{
|
||||
task.ContinueWith(t =>
|
||||
{
|
||||
var aggregateException = t.Exception.Flatten();
|
||||
foreach (var exception in aggregateException.InnerExceptions)
|
||||
{
|
||||
Logger.ErrorException("Task Error", exception);
|
||||
}
|
||||
|
||||
}, TaskContinuationOptions.OnlyOnFaulted);
|
||||
|
||||
return task;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user