Exemplo n.º 1
0
 /// <summary>
 /// The <see cref="AggregateException"/> is re-created, with the optional <c>message</c>. Note that the
 /// incoming <see cref="AggregateException"/> may be null: if so, a new instance is created. The <c>error</c>
 /// argument is inserted into the <see cref="AggregateException.InnerExceptions"/> list at the beginning. If
 /// the <c>message</c> is not null, it is set as the <see cref="Exception.Message"/>; and if null, the
 /// <c>error</c>'s Message is used.
 /// </summary>
 /// <param name="aggregateException">Notice: can be null.</param>
 /// <param name="error">Not null</param>
 /// <param name="message">If null or whitespace, will be set to the <c>error</c>'s Message.</param>
 /// <returns>Not null.</returns>
 /// <exception cref="ArgumentNullException"></exception>
 public static AggregateException AggregateError(
     this AggregateException aggregateException,
     Exception error,
     string message = null)
 => aggregateException.AggregateError(
     (newMessage, innerExceptions) => new AggregateException(newMessage, innerExceptions),
     error,
     message);