pub struct ApiError {
pub status: StatusCode,
pub code: &'static str,
pub title: String,
pub generation: Option<Generation>,
pub balance_exhaustion: Option<BalanceExhaustion>,
pub balance_shortfall: Option<BalanceShortfall>,
}Expand description
A refused control-plane request, rendered as an RFC-7807
application/problem+json body in the Problem shape.
A 401 also carries a Bearer challenge. A 5xx or usage-refused
response adds an optional error_id that matches a warning on the
tollgate::diagnostics target. Converting a StoreError never exposes
its text, in the body or in Debug output (INVARIANTS.md 37).
Fields§
§status: StatusCodeThe HTTP status, also sent as the body’s status.
code: &'static strThe stable machine code clients classify the refusal by. Part of the wire contract.
title: StringA short public description. Not a contract; classify by status and
code.
generation: Option<Generation>The tombstone’s generation on a revoked-principal refusal.
balance_exhaustion: Option<BalanceExhaustion>The allocator’s evidence on a balance-exhausted refusal.
balance_shortfall: Option<BalanceShortfall>The remaining funding on an insufficient-balance refusal, when the
allocator attested it.
Implementations§
Source§impl ApiError
impl ApiError
401 authentication-required: credentials are missing, invalid,
expired or conflicting. The response carries a Bearer challenge.
Sourcepub fn forbidden() -> Self
pub fn forbidden() -> Self
403 scope-forbidden: the credential is valid, but its identity lacks
the role this route requires.
Sourcepub fn not_found(code: &'static str, title: impl Into<String>) -> Self
pub fn not_found(code: &'static str, title: impl Into<String>) -> Self
404 with the given machine code and title.
Sourcepub fn revoked(generation: Generation) -> Self
pub fn revoked(generation: Generation) -> Self
410 revoked-principal: the principal’s snapshot is a tombstone.
Carries the tombstone’s generation so a client can order it against
the positive snapshots it holds (INVARIANTS.md 15).
Sourcepub fn bad_request(code: &'static str, title: impl Into<String>) -> Self
pub fn bad_request(code: &'static str, title: impl Into<String>) -> Self
400 with the given machine code and title.
Sourcepub fn not_implemented(code: &'static str, title: impl Into<String>) -> Self
pub fn not_implemented(code: &'static str, title: impl Into<String>) -> Self
The backend cannot answer this at all, as opposed to answering “nothing” — a distinction a caller must be able to act on differently (GL-48).