File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,8 @@ import type { APIGatewayEvent, APIGatewayProxyResult } from 'aws-lambda';
99import HttpError from 'http-errors' ;
1010
1111export interface TShallotErrorHandlerOptions extends Record < string , unknown > {
12- logger ?: ( ...args : string [ ] ) => void ;
12+ logger ?: ( ...args : unknown [ ] ) => void ;
13+ catchAllErrors ?: boolean ;
1314}
1415
1516/**
@@ -36,6 +37,15 @@ const ShallotAWSHttpErrorHandler: ShallotMiddlewareWithOptions<
3637 statusCode : request . error . statusCode ,
3738 body : request . error . message ,
3839 } ;
40+ } else if ( config . catchAllErrors ) {
41+ if ( config . logger != null ) {
42+ config . logger ( request . error ) ;
43+ }
44+
45+ request . response = {
46+ statusCode : 500 ,
47+ body : 'Internal application server error' ,
48+ } ;
3949 }
4050 } ,
4151} ) ;
You can’t perform that action at this time.
0 commit comments