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:
parent
2ff47ede89
commit
f215026f8b
@ -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 {
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user