示例#1
0
文件: TaskHelper.cs 项目: xyfy/Helper
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Program_AggregateExceptionCatched(object sender, AggregateExceptionArgs e)
 {
     foreach (Exception item in e.AggregateException.InnerExceptions)
     {
         logAction(item);
     }
 }
示例#2
0
文件: TaskHelper.cs 项目: xyfy/Helper
 /// <summary>
 ///
 /// </summary>
 /// <param name="task"></param>
 /// <returns></returns>
 private Task ContinueWith(Task task)
 {
     return(task.ContinueWith(t =>
     {
         if (t.Exception != null)
         {
             AggregateExceptionArgs errArgs = new AggregateExceptionArgs()
             {
                 AggregateException = new AggregateException(t.Exception.InnerExceptions)
             };
             AggregateExceptionCatched(null, errArgs);
         }
     }, TaskContinuationOptions.OnlyOnFaulted));
 }