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 {
1616 ) : Promise < ApiClientError > {
1717 const { text, body } = await this . extractErrorMessage ( response ) ;
1818
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 } ` ;
2223
2324 return new ApiClientError ( errorMessage , response , body ) ;
24-
25- return new ApiClientError ( text , response , body ) ;
2625 }
2726
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 } > {
2930 let text : string = "" ;
3031 let body : ApiError | undefined = undefined ;
3132 try {
@@ -42,12 +43,9 @@ export class ApiClientError extends Error {
4243 }
4344 }
4445
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+ } ;
5250 }
5351}
You can’t perform that action at this time.
0 commit comments