pub struct ApiError { /* private fields */ }Expand description
An API error rendered as { "error": <kind>, "message": <detail> } with
the matching HTTP status.
Implementations§
Source§impl ApiError
impl ApiError
pub fn new(status: StatusCode, kind: &str, message: String) -> Self
Sourcepub fn conflict(message: String) -> Self
pub fn conflict(message: String) -> Self
409 — multitask reject hit an active run, queue full, duplicate id.
Sourcepub fn forbidden(message: String) -> Self
pub fn forbidden(message: String) -> Self
403 — authorization refused the request (R0.9 wave 2: the Cedar plane forbade an admission, a grant, or an overlay). Distinct from 422: the payload is well-formed and the state is not conflicting — the tenant’s standing policy simply does not permit this.
Sourcepub fn too_many_requests(message: String) -> Self
pub fn too_many_requests(message: String) -> Self
429 — a tenant quota rejected the submission (R0.6 wave 3). 429, not 409 or 503: the request is well-formed and the state is not conflicting — the tenant is simply over its allowance, and standard retry-after-backoff client behavior is exactly right.
Sourcepub fn bad_request(message: String) -> Self
pub fn bad_request(message: String) -> Self
400 — malformed payload, unknown graph, bad strategy, non-object input.
Sourcepub fn unprocessable(message: String) -> Self
pub fn unprocessable(message: String) -> Self
422 — the request is well-formed but cannot be processed: replaying a run whose graph is not registered in this process, or whose journal carries evidence server-side replay cannot re-drive.
Sourcepub fn internal(message: String) -> Self
pub fn internal(message: String) -> Self
500 — checkpointer IO failures and other internal errors.
Sourcepub fn shutting_down(message: String) -> Self
pub fn shutting_down(message: String) -> Self
503 — the server is draining (graceful shutdown) and rejects new work. Distinct from 500 so a load balancer’s retry lands on a pod that is still serving.
Trait Implementations§
Source§impl Error for ApiError
impl Error for ApiError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()