#[non_exhaustive]pub enum ProstTwirpError {
TwirpError(TwirpError),
JsonDecodeError(Error),
ProstEncodeError(EncodeError),
ProstDecodeError(DecodeError),
HyperError(Error),
HttpError(Error),
InvalidUri(InvalidUri),
InvalidMethod,
InvalidContentType,
NotFound,
AfterBodyError {
body: Vec<u8>,
method: Option<Method>,
version: Version,
headers: HeaderMap,
status: Option<StatusCode>,
err: Box<ProstTwirpError>,
},
}Expand description
An error that can occur during a call to a Twirp service
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
TwirpError(TwirpError)
A standard Twirp error with a type, message, and some metadata
JsonDecodeError(Error)
An error when trying to decode JSON into an error or object
ProstEncodeError(EncodeError)
An error when trying to encode a protobuf object
ProstDecodeError(DecodeError)
An error when trying to decode a protobuf object
HyperError(Error)
A generic hyper error
HttpError(Error)
A HTTP protocol error
InvalidUri(InvalidUri)
An invalid URI.
InvalidMethod
The HTTP Method was not POST.
InvalidContentType
The request content type was not application/protobuf.
NotFound
No matching method was found for the request.
AfterBodyError
A wrapper for any of the other ProstTwirpErrors that also includes request/response info
Fields
§
status: Option<StatusCode>The response status, only present for client errors
§
err: Box<ProstTwirpError>The underlying error
Implementations§
Source§impl ProstTwirpError
impl ProstTwirpError
Sourcepub fn root_err(self) -> ProstTwirpError
pub fn root_err(self) -> ProstTwirpError
This same error, or the underlying error if it is an AfterBodyError
pub fn into_hyper_response(self) -> Result<Response<Body>, Error>
Trait Implementations§
Source§impl Debug for ProstTwirpError
impl Debug for ProstTwirpError
Source§impl Display for ProstTwirpError
impl Display for ProstTwirpError
Source§impl Error for ProstTwirpError
impl Error for ProstTwirpError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<Error> for ProstTwirpError
impl From<Error> for ProstTwirpError
Source§fn from(v: Error) -> ProstTwirpError
fn from(v: Error) -> ProstTwirpError
Converts to this type from the input type.
Source§impl From<Error> for ProstTwirpError
impl From<Error> for ProstTwirpError
Source§fn from(v: Error) -> ProstTwirpError
fn from(v: Error) -> ProstTwirpError
Converts to this type from the input type.
Source§impl From<TwirpError> for ProstTwirpError
impl From<TwirpError> for ProstTwirpError
Source§fn from(v: TwirpError) -> ProstTwirpError
fn from(v: TwirpError) -> ProstTwirpError
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for ProstTwirpError
impl !RefUnwindSafe for ProstTwirpError
impl Send for ProstTwirpError
impl Sync for ProstTwirpError
impl Unpin for ProstTwirpError
impl !UnwindSafe for ProstTwirpError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more