You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't want to repeat that code everywhere so I made an extension:
/// <summary>/// Aggregates all of the Exceptions from all of the reasons behind all of the errors./// </summary>/// <param name="error">When your <see cref="Result"/> ends in failure.</param>/// <returns>All of the exceptions that happened when processing the <see cref="Result"/></returns>publicstaticAggregateExceptionExceptions<T>(thisResult<T>error){IEnumerable<Exception>exceptionalErrors=error.Errors.SelectMany(err =>err.Reasons.OfType<ExceptionalError>()).Select(ex =>ex.Exception);returnnewAggregateException(exceptionalErrors);}
Now when I'm interacting with a method that accepts just one Exception, I don't have to manually choose which one to pass in. I share the love and pass them all!
Is this a good feature for the library or did I miss something?
The text was updated successfully, but these errors were encountered:
As a noob here, when I read the instructions in Example 3 - reading root cause from errors:
I think that the .NET construct for a bunch of exceptions is the AggregateException
At first I used this:
I don't want to repeat that code everywhere so I made an extension:
Now when I'm interacting with a method that accepts just one Exception, I don't have to manually choose which one to pass in. I share the love and pass them all!
Is this a good feature for the library or did I miss something?
The text was updated successfully, but these errors were encountered: