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

I'm supportive of this, but an additional method to call won't address the problem of devs assuming that `fetch()` throws for them. Having something like `assertOk` added to the options would be better, except we'd still want access to the response here. I don't think that throwing a `TypeError` is ideal here. 

However, to preserve similarity to `throwIfAborted()` without a "Not", I suggest `throwIfError()` or `throwIfErrorStatus()`. 4xx and 5xx are client/server error statuses, so I think it works.

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

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

Received on Tuesday, 27 June 2023 20:55:08 UTC