chore: refactor response error handling

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

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;
}