@@ -6,17 +6,17 @@ namespace PowerUtils.AspNetCore.ErrorHandler
66{
77 public interface IExceptionMapper
88 {
9- ( int Status , IEnumerable < KeyValuePair < string , string > > Errors ) Handle ( Exception exception ) ;
9+ ( int Status , IEnumerable < KeyValuePair < string , ErrorDetails > > Errors ) Handle ( Exception exception ) ;
1010 }
1111
1212
1313 public class ExceptionMapper < TException > : IExceptionMapper
1414 where TException : Exception
1515 {
16- public Func < TException , ( int Status , IEnumerable < KeyValuePair < string , string > > ) > Handler { get ; set ; }
16+ public Func < TException , ( int Status , IEnumerable < KeyValuePair < string , ErrorDetails > > ) > Handler { get ; set ; }
1717
1818
19- public ( int Status , IEnumerable < KeyValuePair < string , string > > Errors ) Handle ( Exception exception )
19+ public ( int Status , IEnumerable < KeyValuePair < string , ErrorDetails > > Errors ) Handle ( Exception exception )
2020 => Handler ( exception as TException ) ;
2121 }
2222
@@ -36,23 +36,23 @@ public ErrorHandlerOptions()
3636 typeof ( NotImplementedException ) ,
3737 new ExceptionMapper < NotImplementedException > ( )
3838 {
39- Handler = ( _ ) => ( StatusCodes . Status501NotImplemented , new Dictionary < string , string > ( ) )
39+ Handler = ( _ ) => ( StatusCodes . Status501NotImplemented , new Dictionary < string , ErrorDetails > ( ) )
4040 }
4141 ) ;
4242
4343 ExceptionMappers . Add (
4444 typeof ( TimeoutException ) ,
4545 new ExceptionMapper < TimeoutException > ( )
4646 {
47- Handler = ( _ ) => ( StatusCodes . Status504GatewayTimeout , new Dictionary < string , string > ( ) )
47+ Handler = ( _ ) => ( StatusCodes . Status504GatewayTimeout , new Dictionary < string , ErrorDetails > ( ) )
4848 }
4949 ) ;
5050 }
5151 }
5252
5353 public static class ErrorHandlerOptionsExtensions
5454 {
55- public static void ExceptionMapper < TException > ( this ErrorHandlerOptions options , Func < TException , ( int Status , IEnumerable < KeyValuePair < string , string > > Errors ) > configureMapper )
55+ public static void ExceptionMapper < TException > ( this ErrorHandlerOptions options , Func < TException , ( int Status , IEnumerable < KeyValuePair < string , ErrorDetails > > Errors ) > configureMapper )
5656 where TException : Exception
5757 {
5858 var exceptionType = typeof ( TException ) ;
@@ -75,6 +75,6 @@ public static void ExceptionMapper<TException>(this ErrorHandlerOptions options,
7575
7676 public static void ExceptionMapper < TException > ( this ErrorHandlerOptions options , Func < TException , int > configureMapper )
7777 where TException : Exception
78- => options . ExceptionMapper < TException > ( e => ( configureMapper ( e ) , new Dictionary < string , string > ( ) ) ) ;
78+ => options . ExceptionMapper < TException > ( e => ( configureMapper ( e ) , new Dictionary < string , ErrorDetails > ( ) ) ) ;
7979 }
8080}
0 commit comments