File tree Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Original file line number Diff line number Diff line change @@ -16,16 +16,17 @@ export class ApiClientError extends Error {
16
16
) : Promise < ApiClientError > {
17
17
const { text, body } = await this . extractErrorMessage ( response ) ;
18
18
19
- const errorMessage = text . length > 0
20
- ? `${ message } : [${ response . status } ${ response . statusText } ] ${ text . trim ( ) } `
21
- : `${ message } : ${ response . status } ${ response . statusText } ` ;
19
+ const errorMessage =
20
+ text . length > 0
21
+ ? `${ message } : [${ response . status } ${ response . statusText } ] ${ text . trim ( ) } `
22
+ : `${ message } : ${ response . status } ${ response . statusText } ` ;
22
23
23
24
return new ApiClientError ( errorMessage , response , body ) ;
24
-
25
- return new ApiClientError ( text , response , body ) ;
26
25
}
27
26
28
- private static async extractErrorMessage ( response : Response ) : Promise < { text : string ; body : ApiError | undefined } > {
27
+ private static async extractErrorMessage (
28
+ response : Response
29
+ ) : Promise < { text : string ; body : ApiError | undefined } > {
29
30
let text : string = "" ;
30
31
let body : ApiError | undefined = undefined ;
31
32
try {
@@ -42,12 +43,9 @@ export class ApiClientError extends Error {
42
43
}
43
44
}
44
45
45
- if ( text . length > 0 ) {
46
- text = `${ message } : [${ response . status } ${ response . statusText } ] ${ text . trim ( ) } ` ;
47
- } else {
48
- text = `${ message } : ${ response . status } ${ response . statusText } ` ;
49
- }
50
-
51
- return new ApiClientError ( text , response , body ) ;
46
+ return {
47
+ text,
48
+ body,
49
+ } ;
52
50
}
53
51
}
You can’t perform that action at this time.
0 commit comments