#[non_exhaustive]pub enum ErrorKind {
InvalidInput,
NotFound,
Conflict,
Unavailable,
Internal,
}Expand description
Coarse class of an OpError. The HTTP status is a pure function of this
class.
| Variant | Wire string | HTTP status |
|---|---|---|
InvalidInput | invalid_input | 400 |
NotFound | not_found | 404 |
Conflict | conflict | 409 |
Unavailable | unavailable | 503 |
Internal | internal | 500 |
invalid_input, not_found, and conflict are caller errors (4xx).
unavailable and internal are internal errors (5xx).
The enum is non_exhaustive
so a later variant does not break a downstream match. The wire spellings
stay the five names above. A JSON string outside that set fails
deserialization. http_status_code is the only
status table.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidInput
The caller sent a value the operation cannot accept.
NotFound
The named resource does not exist.
Conflict
The operation conflicts with the current state.
A dependency the operation needs is not available.
Internal
The operation failed for a reason the caller cannot fix.
Implementations§
Source§impl ErrorKind
impl ErrorKind
Sourcepub const fn http_status_code(self) -> u16
pub const fn http_status_code(self) -> u16
HTTP status that belongs to this kind.
This is the only kind-to-status table. The server conversion reads
it through StatusCode::from_u16.
Sourcepub const fn is_caller_error(self) -> bool
pub const fn is_caller_error(self) -> bool
Returns whether this kind maps to a 4xx status.