1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-22 17:33:14 +01:00

fix error throwing in requests

This commit is contained in:
Tim Daubenschütz 2015-07-17 16:23:25 +02:00
parent f215026f8b
commit 263a7b2676

View File

@ -19,9 +19,9 @@ class Requests {
unpackResponse(response) {
if (response.status >= 500) {
console.logGlobal(new Error(response.status + ' - ' + response.statusText + ' - on URL:' + response.url));
} else if(response.status >= 400 && response.status < 500) {
console.logGlobal(new Error(response.status + ' - ' + response.statusText + ' - on URL:' + response.url));
throw new Error(response.status + ' - ' + response.statusText + ' - on URL:' + response.url);
} else if(response.status >= 400) {
throw new Error(response.status + ' - ' + response.statusText + ' - on URL:' + response.url);
}
return response.text();
}
@ -39,9 +39,9 @@ class Requests {
handleError(err) {
if (err instanceof TypeError) {
console.logGlobal('Server did not respond to the request. (Not even displayed a 500)');
throw new Error('Server did not respond to the request. (Not even displayed a 500)');
} else {
console.logGlobal(err);
throw err;
}
}