Skip to content

Commit

Permalink
Add a changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
threepointone committed Jan 24, 2022
1 parent 6df3050 commit 2e1e6c9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .changeset/tall-cheetahs-juggle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"wrangler": patch
---

fix: propagate api errors to the terminal correctly

Any errors embedded in the response from the Cloudflare API were being lost, because `fetchInternal()` would throw on a non-200 response. This PR fixes that behaviour:

- It doesn't throw on non-200 responses
- It first gets the response text with `.text()` and converts it to an object with `JSON.parse`, so in case the api returns a non json response, we don't lose response we were sent.

Unfortunately, because of the nature of this abstraction, we do lose the response `status` code and `statusText`, but maybe that's acceptable since we have richer error information in the payload. I considered logging the code and text to the terminal, but that may make it noisy.

0 comments on commit 2e1e6c9

Please sign in to comment.