Refactored error handler for events
This commit is contained in:
parent
e822829cc0
commit
8bea1d03da
@ -182,7 +182,14 @@ namespace Aurora.Services.EventManager
|
||||
{
|
||||
actionsCopy.TryGetValue(pair.Key, out Action<BaseEvent> action);
|
||||
Task executionTask = new Task(() => action(bEvent));
|
||||
executionTask.ContinueWith((Task task) => ExceptionHandler(task, pair.Key),
|
||||
|
||||
//Execute task with exception handler
|
||||
executionTask.ContinueWith((Task task) =>
|
||||
{
|
||||
var exception = executionTask.Exception;
|
||||
Console.WriteLine(string.Format("SERVER --- Exception occurred firing event"));
|
||||
this._actionList.Remove(pair.Key);
|
||||
},
|
||||
TaskContinuationOptions.OnlyOnFaulted);
|
||||
|
||||
executionTask.Start();
|
||||
@ -192,13 +199,6 @@ namespace Aurora.Services.EventManager
|
||||
|
||||
}
|
||||
|
||||
private void ExceptionHandler(Task executionTask, string actionKey)
|
||||
{
|
||||
var exception = executionTask.Exception;
|
||||
Console.WriteLine(string.Format("SERVER --- Exception occurred firing event"));
|
||||
this._actionList.Remove(actionKey);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user