systemprompt_models/api/errors/identifier.rs
1//! The canonical `IdValidationError` → [`ApiError`] mapping.
2//!
3//! An identifier that fails to parse at an HTTP edge (a path segment, a
4//! query parameter, a body field) answers 400 naming the identifier type,
5//! with the stable `invalid_identifier` key. It never becomes a fallback id.
6//!
7//! Copyright (c) systemprompt.io — Business Source License 1.1.
8//! See <https://systemprompt.io> for licensing details.
9
10use systemprompt_identifiers::error::IdValidationError;
11
12use super::ApiError;
13
14impl From<IdValidationError> for ApiError {
15 fn from(err: IdValidationError) -> Self {
16 Self::bad_request(err.to_string()).with_error_key("invalid_identifier")
17 }
18}