Skip to content

Commit

Permalink
changes on route to handle internal error 500
Browse files Browse the repository at this point in the history
  • Loading branch information
italomagno committed Nov 15, 2024
1 parent a5964a9 commit 8237f2f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/utils/fetchClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ function request<T>(
return wait(100)
.then(() => fetch(BASE_URL + url, options))
.then(response => {
if (response.status === 500) {
throw new Error('Server error');
}

if (!response.ok) {
throw new Error();
}
Expand Down

0 comments on commit 8237f2f

Please sign in to comment.