Skip to content

Commit acc2a94

Browse files
committed
feat: added error handler
1 parent a3e3b03 commit acc2a94

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/HttpClient.js

+3
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,9 @@ function request(url, {json, method, params, ...customConfig} = {}) {
7575
const errorMessage = `${response.status} ${response.statusText}: ${response.headers.get('x-viur-error')}`
7676
return Promise.reject(new HTTPError(response.status, response.statusText, errorMessage, response))
7777
}
78+
}).catch((error) => {
79+
const errorMessage = `${error.statusCode} ${error.statusText}: ${error.response.headers.get('x-viur-error')}`
80+
return Promise.reject(new HTTPError(error.statusCode, error.statusText, errorMessage, error))
7881
})
7982
}
8083

0 commit comments

Comments
 (0)