Skip to content

Improve error reporting when omdb tries to fetch the inventory for a collection that doesn't exist#10430

Open
piffio wants to merge 2 commits intooxidecomputer:mainfrom
piffio:fix/8336-odb-inventory-collection-missing-collection
Open

Improve error reporting when omdb tries to fetch the inventory for a collection that doesn't exist#10430
piffio wants to merge 2 commits intooxidecomputer:mainfrom
piffio:fix/8336-odb-inventory-collection-missing-collection

Conversation

@piffio
Copy link
Copy Markdown

@piffio piffio commented May 9, 2026

This simple PR adds a three-way discrimination for handling the return value when trying to fetch a specific collection from CockroachDB.

  1. Found -> All good, return it
  2. Not found -> Return an ObjectNotFound error to make it clear that the collection doesn't exist
  3. Multiple matches found -> Return a generic error, as this is unexpected behavior.

Fixes #8336

@davepacheco I am not sure if, for case 3, multiple entries found, it would be better to return a specific error informing of the unexpected state. I lack enough context to understand how unlikely that possibility is.

piffio added 2 commits May 9, 2026 16:22
Add a failing test to reproduce the issue reported in oxidecomputer#8336.
We expect an error informing that collection is missing rather
than a generic failure.
Discriminate different return cases when fetching a collection:

* Found -> Return the collection
* Not found -> Return an ObjectNotFound error
* Multiple entries found -> Return a generic error, as this is
  unexpected behaviour
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

omdb db inventory collections show fails unhelpfully when collection is missing

1 participant