Skip to content

Commit

Permalink
Log queue errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jjxtra committed May 31, 2019
1 parent 6c15366 commit f2680b5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions Core/SerialTaskQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public void Dispose(bool wait)
/// <returns>True if added, false if the queue is or has been disposed</returns>
public bool Add(Func<Task> action, string name = "")
{
if (disposed || name == null)
if (disposed || name == null || action == null)
{
return false;
}
Expand All @@ -219,7 +219,17 @@ public bool Add(Func<Task> action, string name = "")
{
return false;
}
group.Add(action);
group.Add(async () =>
{
try
{
await action();
}
catch (Exception ex)
{
IPBanLog.Error(ex);
}
});
return true;
}

Expand Down

0 comments on commit f2680b5

Please sign in to comment.