Skip to content

Commit

Permalink
fix(controlplane): fix inconsistent error codes for invalid interned ids
Browse files Browse the repository at this point in the history
  • Loading branch information
Meshiest committed Dec 11, 2024
1 parent 51ef740 commit 17b552d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions crates/controlplane/src/server/actions/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::{
env::PortType,
server::error::ServerError,
state::{pending_reconcile_node_map, PendingAgentReconcile},
unwrap_or_bad_request,
unwrap_or_not_found,
};

pub async fn config(
Expand Down Expand Up @@ -56,7 +56,7 @@ pub async fn config(

for WithTargets { nodes, data } in configs {
let binary = if let Some(b) = data.binary.as_ref() {
Some(unwrap_or_bad_request!("invalid binary id", id_or_none(b)))
Some(unwrap_or_not_found!("unknown binary id", id_or_none(b)))
} else {
None
};
Expand Down
4 changes: 2 additions & 2 deletions crates/controlplane/src/server/actions/deploy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use crate::{
env::{error::ExecutionError, Environment},
server::error::ServerError,
state::GlobalState,
unwrap_or_bad_request,
unwrap_or_not_found,
};

pub async fn deploy(
Expand All @@ -27,7 +27,7 @@ pub async fn deploy(
Query(query): Query<AuthQuery>,
Json(action): Json<DeployAction>,
) -> Response {
let cannon_id = unwrap_or_bad_request!("invalid cannon id", id_or_none(&action.cannon));
let cannon_id = unwrap_or_not_found!("unknown cannon id", id_or_none(&action.cannon));
let query_addr = env.cannons.get(&cannon_id).map(|c| c.get_local_query());

if query.is_async() {
Expand Down
4 changes: 2 additions & 2 deletions crates/controlplane/src/server/content.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ async fn serve_binary(
State(state): State<AppState>,
req: Request,
) -> Response {
let storage_id = unwrap_or_bad_request!("invalid storage id", id_or_none(&storage_id));
let binary_id = unwrap_or_bad_request!("invalid binary id", id_or_none(&binary_id));
let storage_id = unwrap_or_not_found!("unknown storage id", id_or_none(&storage_id));
let binary_id = unwrap_or_not_found!("unknown binary id", id_or_none(&binary_id));

let storage = unwrap_or_not_found!(
"storage not found",
Expand Down

0 comments on commit 17b552d

Please sign in to comment.