1
1
import VError from '@voiceflow/verror' ;
2
2
3
+ import * as Guards from '../../../guards' ;
3
4
import type { ExceptionFormat } from '../types' ;
4
- import { formatHttpError , isHttpError } from './httpError' ;
5
- import { formatJavascriptError , isJavascriptError } from './jsError' ;
6
- import { formatVError , isVError } from './vError' ;
5
+ import { formatGaxiosError } from './gaxiosError' ;
6
+ import { formatHttpError } from './httpError' ;
7
+ import { formatJavascriptError } from './jsError' ;
8
+ import { formatVError } from './vError' ;
7
9
8
10
export const formatError = ( err : unknown ) : ExceptionFormat => {
9
11
let exception : ExceptionFormat = {
@@ -12,9 +14,10 @@ export const formatError = (err: unknown): ExceptionFormat => {
12
14
message : 'Unknown error' ,
13
15
} ;
14
16
15
- if ( isVError ( err ) ) exception = mergeExceptionResult ( exception , formatVError ( err ) ) ;
16
- else if ( isHttpError ( err ) ) exception = mergeExceptionResult ( exception , formatHttpError ( err ) ) ;
17
- else if ( isJavascriptError ( err ) ) exception = mergeExceptionResult ( exception , formatJavascriptError ( err ) ) ;
17
+ if ( Guards . isVError ( err ) ) exception = mergeExceptionResult ( exception , formatVError ( err ) ) ;
18
+ else if ( Guards . isHttpError ( err ) ) exception = mergeExceptionResult ( exception , formatHttpError ( err ) ) ;
19
+ else if ( Guards . isGaxiosError ( err ) ) exception = mergeExceptionResult ( exception , formatGaxiosError ( err ) ) ;
20
+ else if ( Guards . isJavascriptError ( err ) ) exception = mergeExceptionResult ( exception , formatJavascriptError ( err ) ) ;
18
21
19
22
return exception ;
20
23
} ;
0 commit comments