Skip to content

Instantly share code, notes, and snippets.

View mattp0123's full-sized avatar
🧀
Hi

mattpeng mattp0123

🧀
Hi
  • Taiwan
View GitHub Profile
@mattp0123
mattp0123 / handle-fetch-api-error.ts
Last active July 17, 2024 16:27
Handle Fetch API error
class HTTPError extends Error {
constructor(public response: Response) {
super(response.statusText)
this.name = 'HTTPError'
}
}
const abortController = new AbortController()
try {