Re: [whatwg/fetch] Consider response.throwIfNotOk() (Issue #1679)

I came into this agreeing with @shgysk8zer0 that throwing a "plain" `TypeError` or `Error` might not be ideal. For a second I was considering if it would make sense to put the `Resonse` as [cause] on an `Error`, since the error is caused by, well, the response. But on second thought that would seem to go against the idea of `cause`.

But the more I think about it just an error with `status` and `statusText` feels sufficient like @jakearchibald suggested - for any more conplex needs its limits might provide a good push towards branching on `response.ok`, and that is what I'd personally reach towards in almost all cases even if a function asserting the status existed

[cause]: https://github.com/tc39/proposal-error-cause

-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/1679#issuecomment-1610302489
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/issues/1679/1610302489@github.com>

Received on Tuesday, 27 June 2023 22:24:28 UTC