Display API message on not found errors#1935
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
3736782 to
9b6857e
Compare
9b6857e to
e1744ea
Compare
david-crespo
commented
Feb 2, 2024
| message = 'Action not authorized' | ||
| } else if (code === 'ObjectNotFound') { | ||
| message = 'Object not found' | ||
| message = capitalize(resp.data.message) |
Collaborator
Author
There was a problem hiding this comment.
This is the entire change. Everything else is tests.
david-crespo
added a commit
to oxidecomputer/omicron
that referenced
this pull request
Feb 2, 2024
oxidecomputer/console@1a4f5d8...5bee1f5 * [5bee1f5b](oxidecomputer/console@5bee1f5b) oxidecomputer/console#1936 * [16b5b32a](oxidecomputer/console@16b5b32a) oxidecomputer/console#1935 * [2aa720d2](oxidecomputer/console@2aa720d2) bump API and pull in ipv4/ipv6 zod validation change
david-crespo
added a commit
to oxidecomputer/omicron
that referenced
this pull request
Feb 2, 2024
oxidecomputer/console@1a4f5d8...5bee1f5 * [5bee1f5b](oxidecomputer/console@5bee1f5b) oxidecomputer/console#1936 * [16b5b32a](oxidecomputer/console@16b5b32a) oxidecomputer/console#1935 * [2aa720d2](oxidecomputer/console@2aa720d2) bump API and pull in ipv4/ipv6 zod validation change
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have had multiple people raise the issue that when they tried to create an instance without a default IP pool in their silo, it was almost impossible to figure out what the problem was.
oxidecomputer/omicron#4864
oxidecomputer/omicron#4954
I improved the API error message in oxidecomputer/omicron#4880, but this morning I figured out that in both cases, they were using the web console, and it did not matter what the API error was because we only show
OBJECT NOT FOUNDon instance create when we get a 404 back.console/libs/api/errors.ts
Lines 58 to 59 in 2aa720d
So this PR changes that behavior so that the client-side error object we pass around contains the error message from the API. As I mentioned here, it might be nice to change the error code from 404 to something else, but I really think this PR gets us 80% of the way there.
My only concern here is that there might be some spots where "Object not found" was nicer than the API error and made sense in context, but now we will be displaying the API error. But hopefully that can't be too bad, since the API messages are all designed to be human readable and helpful.
Before
After