Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

7
  • Where's the async declaration? Commented May 24, 2019 at 15:32
  • well, it is all inside an async function, yes Commented May 24, 2019 at 15:33
  • Fetch API throws an exception for everything that is different from 404, 505 or 200 -- Fetch is only supposed to reject for network errors not based on status code. Commented May 24, 2019 at 15:34
  • @Mark: but when the server returns 400, is it considered as a network error? I have an unhanded exception in this case and want to avoid it. Commented May 24, 2019 at 15:37
  • If you just try to make a simple and pretty architecture you may want to create a wrapper around fetch to handle cases like this, i mean make your own fetch with blackjack and desired error handling. Also mention this - stackoverflow.com/questions/50330795 Commented May 24, 2019 at 15:40