- From: Jake Archibald <notifications@github.com>
- Date: Sun, 29 Mar 2020 05:37:44 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Sunday, 29 March 2020 12:37:57 UTC
FWIW that can be rewritten as: ```js return fetch(url, { method: 'POST', headers, body: JSON.stringify(body), }).then((response) => response.json().then((data) => { if (responsePromise.status >= 400) { throw Error(data.err); } return data; }), ); ``` Also, you should only reject error objects (as I've done in the example above). -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/18#issuecomment-605629519
Received on Sunday, 29 March 2020 12:37:57 UTC