#[non_exhaustive]pub enum Error {
Configuration(ConfigError),
Serialization(Error),
Request(Error),
ResponseBody {
metadata: Box<ResponseMetadata>,
source: Error,
},
Postgrest {
metadata: Box<ResponseMetadata>,
source: Box<PostgrestError>,
},
Decode {
metadata: Box<ResponseMetadata>,
source: Box<DecodeError>,
},
ResponseDecode {
metadata: Box<ResponseMetadata>,
source: Error,
},
Count {
metadata: Box<ResponseMetadata>,
source: CountError,
},
}Expand description
A configuration, request, or response failure, without nested result layers.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Configuration(ConfigError)
Invalid client or request configuration.
Serialization(Error)
Deferred payload serialization failure.
Request(Error)
No usable HTTP response was received.
ResponseBody
Reading a successful or unsuccessful response body failed.
Postgrest
A structured server error; observed HTTP status is authoritative.
Decode
A malformed error envelope, retaining exact body bytes in its source.
ResponseDecode
A successful response did not match the requested JSON shape.
Count
A requested row count was missing or invalid.
Implementations§
Source§impl Error
impl Error
Sourcepub fn server_response(&self) -> Option<(StatusCode, Option<&ErrorResponse>)>
pub fn server_response(&self) -> Option<(StatusCode, Option<&ErrorResponse>)>
Observed non-success HTTP status and any decoded server error body.
Malformed envelopes and failed body reads retain their status with no body. Successful-response decode and count failures are not server errors.
Sourcepub fn is_jwt_expired(&self) -> bool
pub fn is_jwt_expired(&self) -> bool
Whether a JWT validation error specifically reports token expiration.
Other JWT failures, including invalid signatures, return false.
Sourcepub const fn postgrest_error(&self) -> Option<&PostgrestError>
pub const fn postgrest_error(&self) -> Option<&PostgrestError>
The decoded structured server error without destructuring this error.
Sourcepub fn postgrest_body(&self) -> Option<&ErrorResponse>
pub fn postgrest_body(&self) -> Option<&ErrorResponse>
The decoded server response, including code, details and hint.
Sourcepub fn postgrest_response(&self) -> Option<(StatusCode, &ErrorResponse)>
pub fn postgrest_response(&self) -> Option<(StatusCode, &ErrorResponse)>
The authoritative HTTP status and borrowed structured server response.
The status comes from the observed response, not the error code’s inferred
status. Returns None when no structured server error was decoded.
Sourcepub const fn response_metadata(&self) -> Option<&ResponseMetadata>
pub const fn response_metadata(&self) -> Option<&ResponseMetadata>
Metadata when a response was observed.
Sourcepub fn status(&self) -> Option<StatusCode>
pub fn status(&self) -> Option<StatusCode>
Authoritative observed HTTP status, if available.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()