Skip to content
This repository has been archived by the owner on Sep 3, 2019. It is now read-only.

Commit

Permalink
Add some error handlign
Browse files Browse the repository at this point in the history
  • Loading branch information
parisk committed Jan 14, 2018
1 parent 5dbe929 commit 983468a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions static/js/ceryx.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,25 @@ export let ceryx = {
response.json().then((data) => {
routes.dispatch(setRoutes, data);
});
} else {
alerts.dispatch(addAlert, {
id: 'routes-fetch-not-ok',
severity: 'danger',
dismissible: true,
timeout: 10,
content: `We could not fetch Ceryx' routes. Response status code: ${response.status}.`
});
}
}).catch((error) => {
console.error('Promise error while fetching routes');
console.error(error);
alerts.dispatch(addAlert, {
id: 'routes-fetch-promise-error',
severity: 'danger',
dismissible: true,
timeout: 10,
content: `We could not fetch Ceryx' routes. View browser's console for more details.`
});
});

return promise;
Expand Down

0 comments on commit 983468a

Please sign in to comment.