pub enum Code {
Show 18 variants
Internal,
BadRequest,
NotFound,
MethodNotAllowed,
Gone,
Conflict,
PayloadTooLarge,
RequestTimeout,
RateLimited,
Unavailable,
ValidationFailed,
Unauthorized,
Forbidden,
UnprocessableEntity,
Timeout,
Canceled,
DownstreamError,
DownstreamTimeout,
}Expand description
Machine-readable error codes that remain stable across releases.
Variants§
Internal
Internal server error (500).
BadRequest
Bad request error (400).
NotFound
Resource not found (404).
MethodNotAllowed
HTTP method not allowed (405).
Gone
Resource permanently deleted (410).
Conflict
Resource conflict, often due to concurrent modification (409).
PayloadTooLarge
Request payload exceeds size limit (413).
RequestTimeout
Request timed out before completion (408).
RateLimited
Too many requests, client should retry later (429).
Service temporarily unavailable (503).
ValidationFailed
Input validation failed (400).
Authentication required or credentials invalid (401).
Forbidden
Authenticated but not permitted to access resource (403).
UnprocessableEntity
Request is well-formed but semantically invalid (422).
Timeout
Gateway or processing timeout (504).
Canceled
Request was canceled by client (499).
DownstreamError
Downstream service returned an error (502).
DownstreamTimeout
Downstream service timed out (504).
Implementations§
Source§impl Code
impl Code
Sourcepub fn default_status(&self) -> u16
pub fn default_status(&self) -> u16
Returns the default HTTP status code for this error code.
Sourcepub fn is_retryable_default(&self) -> bool
pub fn is_retryable_default(&self) -> bool
Returns whether this error is retryable by default.
Sourcepub fn default_message(&self) -> &'static str
pub fn default_message(&self) -> &'static str
Returns a default human-readable message for this code.