Skip to content

Commit

Permalink
Spruce up error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobtylerwalls committed Feb 2, 2024
1 parent 8bf3c9a commit 3e66b54
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -155,13 +155,17 @@ const postDisplayedListToServer = async () => {
}
);
if (!response.ok) {
const body = await response.json();
throw new Error(body.message);
try {
const body = await response.json();
throw new Error(body.message);
} catch {
throw new Error(response.statusText);
}
}
} catch (error) {
toast.add({
severity: "error",
summary: error.message || "Save failed",
summary: error || "Save failed",
life: 3000,
});
}
Expand Down

0 comments on commit 3e66b54

Please sign in to comment.