pub enum Error<E = ()> {
InvalidRequest(String),
CommunicationError(Error),
InvalidUpgrade(Error),
ErrorResponse(ResponseValue<E>),
ResponseBodyError(Error),
InvalidResponsePayload(Bytes, Error),
UnexpectedResponse(Response),
PreHookError(String),
}
Expand description
Error produced by generated client methods.
The type parameter may be a struct if there’s a single expected error type or an enum if there are multiple valid error types. It can be the unit type if there are no structured returns expected.
Variants§
InvalidRequest(String)
The request did not conform to API requirements.
CommunicationError(Error)
A server error either due to the data, or with the connection.
InvalidUpgrade(Error)
An expected response when upgrading connection.
ErrorResponse(ResponseValue<E>)
A documented, expected error response.
ResponseBodyError(Error)
Encountered an error reading the body for an expected response.
InvalidResponsePayload(Bytes, Error)
An expected response code whose deserialization failed.
UnexpectedResponse(Response)
A response not listed in the API description. This may represent a
success or failure response; check status().is_success()
.
PreHookError(String)
An error occurred in the processing of a request pre-hook.
Implementations§
Source§impl<E> Error<E>
impl<E> Error<E>
Sourcepub fn status(&self) -> Option<StatusCode>
pub fn status(&self) -> Option<StatusCode>
Returns the status code, if the error was generated from a response.
Sourcepub fn into_untyped(self) -> Error
pub fn into_untyped(self) -> Error
Converts this error into one without a typed body.
This is useful for unified error handling with APIs that distinguish various error response bodies.