pub enum Error<E = ()> {
InvalidRequest(String),
CommunicationError(Error),
ErrorResponse(ResponseValue<E>),
InvalidResponsePayload(Error),
UnexpectedResponse(Response),
}
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.
ErrorResponse(ResponseValue<E>)
A documented, expected error response.
InvalidResponsePayload(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()
.
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.