Repository navigation
Show server errors on create in a very basic way - #345
Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/oxidecomputer/console-ui-storybook/7RWYiS8n4FaXfvgnf5Drry3zxjSn |
8ce9c64 to
2b6bd9d
Compare
|
|
||
| const parseJsonAndRethrow = async (error: Response) => | ||
| Promise.reject({ raw: error, data: await error.json() }) | ||
|
|
There was a problem hiding this comment.
Everything else in this PR is pretty inconsequential because it's just last-mile display stuff, but this changes a widely used API so it's worth thinking about and revisiting. I was hoping to be able to leave the error value as a Response object, but you can only call .json() once on it (plus it returns a promise, so the calling code has to deal with async crap too). I want to be able to refer to the error JSON as many times as we need to in the calling code. So we just parse it out here once and for all.
37f207f to
93a6c5d
Compare
93a6c5d to
4043f0a
Compare
4043f0a to
f6d88fa
Compare
Closes #330
Pulling the string out of the server error is a bit of a hack and we'll want to polish it up later.