@@ -83,7 +83,7 @@ public static ErrorState Try<TArg>(TArg arg, Action<TArg> action)
8383 ( false , false ) => Success ( ) ,
8484 ( true , false ) => a . _error ,
8585 ( false , true ) => b . _error ,
86- ( true , true ) => new AggregateException ( a . _error , b . _error ) ,
86+ ( true , true ) => new AggregateException ( a . _error , b . _error ) . Flatten ( ) ,
8787 } ;
8888
8989 public static ErrorState < E > CombineErrors < E > ( ErrorState < E > a , ErrorState < E > b , Func < E , E , E > errorCombiner ) => ( a . _isError , b . _isError ) switch
@@ -108,9 +108,9 @@ public static ErrorState Try<TArg>(TArg arg, Action<TArg> action)
108108 ( true , false , false ) => a . _error ,
109109 ( false , true , false ) => b . _error ,
110110 ( false , false , true ) => c . _error ,
111- ( true , true , false ) => new AggregateException ( a . _error , b . _error ) ,
112- ( true , false , true ) => new AggregateException ( a . _error , c . _error ) ,
113- ( false , true , true ) => new AggregateException ( b . _error , c . _error ) ,
114- ( true , true , true ) => new AggregateException ( a . _error , b . _error , c . _error ) ,
111+ ( true , true , false ) => new AggregateException ( a . _error , b . _error ) . Flatten ( ) ,
112+ ( true , false , true ) => new AggregateException ( a . _error , c . _error ) . Flatten ( ) ,
113+ ( false , true , true ) => new AggregateException ( b . _error , c . _error ) . Flatten ( ) ,
114+ ( true , true , true ) => new AggregateException ( a . _error , b . _error , c . _error ) . Flatten ( ) ,
115115 } ;
116116}
0 commit comments