mirror of
https://github.com/ascribe/onion.git
synced 2024-11-15 01:25:17 +01:00
PR Feedback: Change API error handling to saver approach
This commit is contained in:
parent
40095f7fbf
commit
7283ae7574
@ -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);
|
||||
});
|
||||
});
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user