pub enum ApiErrorCode {
Unauthorized,
Forbidden,
BadRequest,
NotFound,
Conflict,
InvalidState,
TooManyRequests,
Protocol,
Internal,
}Expand description
Stable error code returned to API callers. The set is intentionally small so that integrators can branch on a finite alphabet rather than parsing human-readable messages.
Variants§
The caller is not authenticated, or credentials are invalid.
Forbidden
The caller is authenticated but lacks permission for this operation.
BadRequest
The request payload failed validation.
NotFound
The requested resource does not exist.
Conflict
The request conflicts with current state (e.g. duplicate resource).
InvalidState
The system is in setup mode and the requested endpoint is not allowed until initialization is complete (or the endpoint requires setup mode).
TooManyRequests
Caller is being rate-limited.
Protocol
An OAuth 2.0 / OIDC protocol error. The exact error field follows
the relevant RFCs (e.g. invalid_grant, invalid_client).
Internal
Catch-all for anything we did not anticipate. The body deliberately
does not carry internal cause; correlate via request_id.
Implementations§
Source§impl ApiErrorCode
impl ApiErrorCode
Sourcepub const fn http_status(self) -> u16
pub const fn http_status(self) -> u16
HTTP status code commonly associated with this error.
Trait Implementations§
Source§impl Clone for ApiErrorCode
impl Clone for ApiErrorCode
Source§fn clone(&self) -> ApiErrorCode
fn clone(&self) -> ApiErrorCode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ApiErrorCode
Source§impl Debug for ApiErrorCode
impl Debug for ApiErrorCode
Source§impl<'de> Deserialize<'de> for ApiErrorCode
impl<'de> Deserialize<'de> for ApiErrorCode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for ApiErrorCode
Source§impl PartialEq for ApiErrorCode
impl PartialEq for ApiErrorCode
Source§fn eq(&self, other: &ApiErrorCode) -> bool
fn eq(&self, other: &ApiErrorCode) -> bool
self and other values to be equal, and is used by ==.