Skip to content

Datastore has its own error type #357

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions common/src/api/external/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,7 @@ pub enum ResourceType {
VpcRouter,
Oximeter,
MetricProducer,
ConsoleSession,
}

impl Display for ResourceType {
Expand All @@ -482,6 +483,7 @@ impl Display for ResourceType {
ResourceType::VpcRouter => "vpc router",
ResourceType::Oximeter => "oximeter",
ResourceType::MetricProducer => "metric producer",
ResourceType::ConsoleSession => "console session",
}
)
}
Expand Down
12 changes: 12 additions & 0 deletions nexus/src/db/collection_insert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,18 @@ where
// summary, the CTE generates a division by zero intentionally
// if the collection doesn't exist in the database.
Err(InsertError::CollectionNotFound)
// it would simplify things elsewhere if we were willing to
// mislead slightly here and return a diesel error
// instead:
//
// Err(PoolError::Connection(
// ConnectionError::Query(diesel::result::Error::NotFound),
// ))
//
// the downside is you loose the special info that this is a
// NotFound error that arose specifically while trying to pull a
// collection to insert into

}
Err(other) => Err(InsertError::DatabaseError(other)),
}
Expand Down
Loading