1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-03 10:25:08 +01:00

better error messages for API failures

This commit is contained in:
Tim Daubenschütz 2015-07-17 16:12:24 +02:00
parent 2ff47ede89
commit f215026f8b
2 changed files with 7 additions and 2 deletions

View File

@ -53,6 +53,11 @@ let GlobalNotification = React.createClass({
onChange(state) {
let notification = this.extractFirstElem(state.notificationQue);
// error handling for notifications
if(notification.message && notification.type === 'danger') {
console.logGlobal(new Error(notification.message.message));
}
if(notification.show) {
this.setState(notification);
} else {

View File

@ -19,9 +19,9 @@ class Requests {
unpackResponse(response) {
if (response.status >= 500) {
console.logGlobal(new Error(response.status + ': Generic server error - ' + response.statusText));
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 + ': Generic request error - ' + response.statusText));
console.logGlobal(new Error(response.status + ' - ' + response.statusText + ' - on URL:' + response.url));
}
return response.text();
}