File tree Expand file tree Collapse file tree 2 files changed +7
-1
lines changed
Expand file tree Collapse file tree 2 files changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,12 @@ const logClientSideError = async (clientSideErrorType: ClientSideErrorTypes): Pr
1212} ;
1313
1414const logClientSideErrorAction = async ( clientSideErrorType : ClientSideErrorTypes ) : Promise < void > => {
15- log . error ( { context : { clientSideErrorType : clientSideErrorType } } , "Client side error occurred" ) ;
15+ const validClientSideErrorTypes = Object . values ( ClientSideErrorTypes ) as string [ ] ;
16+ const validatedErrorType = validClientSideErrorTypes . includes ( clientSideErrorType )
17+ ? clientSideErrorType
18+ : ClientSideErrorTypes . UNKNOWN_ERROR_REASON ;
19+
20+ log . error ( { context : { clientSideErrorType : validatedErrorType } } , "Client side error occurred" ) ;
1621} ;
1722
1823export default logClientSideError ;
Original file line number Diff line number Diff line change @@ -2,4 +2,5 @@ export const AWS_PRIMARY_REGION = "eu-west-2";
22
33export enum ClientSideErrorTypes {
44 UNHANDLED_ERROR = "UNHANDLED_ERROR" ,
5+ UNKNOWN_ERROR_REASON = "UNKNOWN_ERROR_REASON" ,
56}
You can’t perform that action at this time.
0 commit comments