- From: Chris Zuber <notifications@github.com>
- Date: Tue, 27 Jun 2023 16:50:46 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 27 June 2023 23:50:51 UTC
If you get a response with a status, it's pretty likely that the response body contains the actual error, and the headers contain other useful info. And, unlike other `fetch()` errors, we will have a response with headers and maybe a body here. I think that warrants different behavior. Consider HTTP 404 Method Not Allowed for example. The Allow header is required for that status, so throwing an error that loses the headers is just not very useful. To omit that info would be like giving a 302 Found status but not the Location header... It's incomplete, at best. I strongly advocate that any such method that throws an error only upon receiving a response provides access to the body and the headers. It really does make the difference between being nearly useless and actually useful. Plus, we already have the response (completely, outside of streaming)... We may as well make use of it instead of just throwing it away. This probably implies the addition of an `HTTPError` or `ResponseError`. -- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/1679#issuecomment-1610372212 You are receiving this because you are subscribed to this thread. Message ID: <whatwg/fetch/issues/1679/1610372212@github.com>
Received on Tuesday, 27 June 2023 23:50:51 UTC