Skip to content

Commit

Permalink
escalate all http error codes
Browse files Browse the repository at this point in the history
  • Loading branch information
NeoTheThird committed Mar 23, 2022
1 parent 8eb24ee commit fd2de8c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/core/plugins/systemimage/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ const getImages = (channel, device, wipe, enable = [], disable = []) =>
api
.get(`${channel}/${device}/index.json`)
.catch(error => {
if (error?.response?.status === 404) throw new Error("404");
else throw new Error("no network");
throw new Error(error?.response?.status || "no network");
})
.then(({ data }) => data.images.filter(({ type }) => type === "full").pop())
.then(image => {
Expand Down
2 changes: 1 addition & 1 deletion src/core/plugins/systemimage/api.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ unmount system",
});
});
it("should reject on network error", done => {
axios.get.mockRejectedValueOnce({ response: {} });
axios.get.mockRejectedValueOnce();
api.getImages("1.0", "lenok").catch(e => {
expect(e.message).toEqual("no network");
done();
Expand Down

0 comments on commit fd2de8c

Please sign in to comment.