1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-28 08:37:59 +02:00

PR Feedback: Change API error handling to saver approach

This commit is contained in:
Tim Daubenschütz 2015-09-30 11:22:20 +02:00
parent 40095f7fbf
commit 7283ae7574
2 changed files with 6 additions and 1 deletions

View File

@ -33,6 +33,10 @@ class EditionListActions {
EditionListFetcher
.fetch(pieceId, page, pageSize, orderBy, orderAsc, filterBy)
.then((res) => {
if(res && !res.editions) {
throw new Error('Piece has no editions to fetch.');
}
this.actions.updateEditionList({
pieceId,
page,
@ -46,6 +50,7 @@ class EditionListActions {
resolve(res);
})
.catch((err) => {
console.logGlobal(err);
reject(err);
});
});

View File

@ -21,7 +21,7 @@ class Requests {
}
unpackResponse(response) {
if (response.status >= 400) {
if (response.status >= 500) {
throw new Error(response.status + ' - ' + response.statusText + ' - on URL:' + response.url);
}