chore: refactor response error handling

This commit is contained in:
Ramires Viana committed 2022-05-04 12:11:36 +00:00
1 parent d1d7b23da6
commit 96afaca0ad
16 files changed
+61 -93

No files matched your search

+7
View File
@@ -26,6 +26,13 @@ export async function fetchURL(url, opts) {
await renew(store.state.jwt);
}
if (res.status < 200 || res.status > 299) {
const error = new Error(await res.text());
error.status = res.status;
throw error;
}
return res;
}