File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -9,15 +9,22 @@ import { errorLogger } from "./logger.util";
9
9
export const throwAndDelegateError = (
10
10
error : Error | AxiosError ,
11
11
source : string ,
12
- apiKey ?: string
12
+ apiKey ?: string ,
13
+ logMessage ?: string
13
14
) => {
14
- const message =
15
+ const errorMessage =
15
16
error instanceof AxiosError
16
17
? error . response ?. data
17
18
? JSON . stringify ( error . response ?. data )
18
19
: error . message
19
20
: error . message ;
20
- errorLogger ( source , message , apiKey ) ;
21
+
22
+ if ( logMessage ) {
23
+ errorLogger ( source , logMessage , apiKey , errorMessage ) ;
24
+ } else {
25
+ errorLogger ( source , errorMessage , apiKey ) ;
26
+ }
27
+
21
28
if ( error instanceof AxiosError ) {
22
29
const status = error . response ?. status || 500 ;
23
30
var errorType : IntegrationErrorType ;
@@ -37,7 +44,7 @@ export const throwAndDelegateError = (
37
44
errorType = IntegrationErrorType . INTEGRATION_ERROR_UNAVAILABLE ;
38
45
break ;
39
46
default :
40
- throw new ServerError ( status , `${ source } (${ message } )` ) ;
47
+ throw new ServerError ( status , `${ source } (${ errorMessage } )` ) ;
41
48
}
42
49
throw new ServerError ( DELEGATE_TO_FRONTEND_CODE , errorType ) ;
43
50
}
You can’t perform that action at this time.
0 commit comments