#[non_exhaustive]pub enum ErrorCode {
Show 18 variants
ServiceUnavailable,
ConnectionFailed,
Timeout,
RateLimited,
NotFound,
AlreadyExists,
Conflict,
InvalidInput,
MissingField,
InvalidFormat,
Unauthorized,
Forbidden,
TokenExpired,
InvalidToken,
Internal,
DatabaseError,
ExternalService,
Cancelled,
}Expand description
Machine-readable error code.
Defined as an enum so downstream code gets exhaustive match checking.
#[non_exhaustive] allows new variants to be added without a SemVer break.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
The downstream service is unavailable; retryable.
ConnectionFailed
Could not establish a connection to a dependency; retryable.
Timeout
An operation exceeded its deadline; retryable.
RateLimited
Request was rejected because a rate limit was exceeded; retryable.
NotFound
The requested resource does not exist.
AlreadyExists
A resource with the same identity already exists.
Conflict
The request conflicts with the current state of a resource.
InvalidInput
One or more input fields failed validation.
MissingField
A required field was absent from the request.
InvalidFormat
A field value could not be parsed into the expected format.
The caller has not been authenticated.
Forbidden
The caller is authenticated but does not have permission.
TokenExpired
The authentication token has expired.
InvalidToken
The authentication token is malformed or unrecognised.
Internal
An unexpected internal error occurred.
DatabaseError
A database operation failed.
ExternalService
An external service returned an error; retryable.
Cancelled
The operation was cancelled by the caller or system before completion (e.g., context cancellation, client disconnect).
Implementations§
Source§impl ErrorCode
impl ErrorCode
Sourcepub fn is_retryable(self) -> bool
pub fn is_retryable(self) -> bool
Returns true for transient errors worth retrying.
Sourcepub fn http_status(self) -> StatusCode
pub fn http_status(self) -> StatusCode
Canonical HTTP status code for this error.