File tree Expand file tree Collapse file tree 1 file changed +15
-17
lines changed
Expand file tree Collapse file tree 1 file changed +15
-17
lines changed Original file line number Diff line number Diff line change @@ -60,23 +60,21 @@ class ApiClient {
6060 return resolve ( response ) ;
6161 } ) ;
6262 } )
63- . catch ( ( error ) => {
64- return error . response . text ( ) . then ( ( body ) => {
65- if ( error instanceof ky . HTTPError ) {
66- error = new api_errors . ResponseError (
67- request ,
68- error . response . status ,
69- body
70- ) ;
71- } else if ( error instanceof ky . TimeoutError ) {
72- error = new api_errors . TimeoutError ( request , error ) ;
73- }
74- if ( callback ) {
75- return callback ( error ) ;
76- }
77- throw error ;
78- } ) ;
79- } ) ;
63+ . catch ( async ( error ) => {
64+ if ( error instanceof ky . TimeoutError ) {
65+ error = new api_errors . TimeoutError ( request , error ) ;
66+ } else if ( error instanceof ky . HTTPError ) {
67+ error = new api_errors . ResponseError (
68+ request ,
69+ error . response . status ,
70+ await error . response . text ( )
71+ ) ;
72+ }
73+ if ( callback ) {
74+ return callback ( error ) ;
75+ }
76+ throw error ;
77+ } ) ;
8078 } )
8179 }
8280
You can’t perform that action at this time.
0 commit comments