Skip to content

Conversation

@DanielSchiavini
Copy link
Contributor

@DanielSchiavini DanielSchiavini commented Nov 12, 2025

Copy link

@0xAlunara 0xAlunara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fetch promises only reject with a TypeError when a network error occurs. Since 4xx and 5xx responses aren't network errors, there's nothing to catch. You'll need to throw an error yourself to use Promise#catch.

A fetch() promise only rejects when the request fails, for example, because of a badly-formed request URL or a network error. A fetch() promise does not reject if the server responds with HTTP status codes that indicate errors (404, 504, etc.). Instead, a then() handler must check the Response.ok and/or Response.status properties.

@DanielSchiavini DanielSchiavini dismissed 0xAlunara’s stale review November 13, 2025 08:17

I as explained in the comment, we do get a network error because of the missing CORS headers in the 429 response. CORS error causes fetch to generate an exception.

@DanielSchiavini DanielSchiavini merged commit 5499f04 into main Nov 13, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants