sindresorhus / ky

🌳 Tiny & elegant JavaScript HTTP client based on the Fetch API
MIT License
11.91k stars 342 forks source link

is there a way to prevent HttpError when response is not in range #532

Closed michelecocuccio closed 9 months ago

michelecocuccio commented 9 months ago

Hello, I am working with an external company that is still working on their api and at the moment it return some out of range status code, and I get the ERROR RangeError: Failed to construct 'Response': The status provided (0) is outside the range [200, 599].

Is there a way to disable / prevent this error? I tried with throwHttpErrors set to false but it does nothing. The thing is that in this way I can't test the entire flow of the app as I always get this error first and can't intercept any failed request etc...

Screenshot 2023-09-26 at 16 38 15
sindresorhus commented 9 months ago

The error is coming from your Fetch polyfill, not from Ky.

michelecocuccio commented 9 months ago

The error is coming from your Fetch polyfill, not from Ky.

Sorry. My bad!