Skip to content

Commit

Permalink
chore: baseline for handling fetch exception for 4xx and 5xx
Browse files Browse the repository at this point in the history
  • Loading branch information
edysegura committed Jan 14, 2025
1 parent 14902d6 commit 1b022c5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions handling-fetch/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
async function doRequest() {
let response
try {
response = await fetch('https://httpstat.us/400')
if (response.ok) {
return response
}
throw new Error(`Error: Response status ${response.status}`)
} catch (error) {
return error
}
}
Empty file added handling-fetch/index.html
Empty file.

0 comments on commit 1b022c5

Please sign in to comment.