pub enum RequestError {
BadRequest {
name: String,
violations: Vec<PathError>,
},
Path(PathError),
Generic(GenericErrorBox),
Encode(EncodeError),
Decode(DecodeError),
}Expand description
Request error types.
Variants§
BadRequest
Invalid request with field violations.
Path(PathError)
Path-specific error.
Generic(GenericErrorBox)
Generic error.
Encode(EncodeError)
Encode error.
Decode(DecodeError)
Decode error.
Implementations§
Source§impl RequestError
impl RequestError
Sourcepub fn bad_request<N, V, F, E>(name: N, violations: V) -> Self
pub fn bad_request<N, V, F, E>(name: N, violations: V) -> Self
Creates a bad request error.
Sourcepub fn generic<E: Into<GenericErrorBox>>(error: E) -> Self
pub fn generic<E: Into<GenericErrorBox>>(error: E) -> Self
Creates a generic error.
Sourcepub fn field_index<F, E>(field: F, index: usize, error: E) -> Self
pub fn field_index<F, E>(field: F, index: usize, error: E) -> Self
Creates a field index error.
Sourcepub fn field_parse<F, E>(field: F, error: E) -> Self
pub fn field_parse<F, E>(field: F, error: E) -> Self
Creates a field parse error.
Sourcepub fn index<E>(index: usize, error: E) -> Selfwhere
E: Into<GenericErrorBox>,
pub fn index<E>(index: usize, error: E) -> Selfwhere
E: Into<GenericErrorBox>,
Creates an index error.
Sourcepub fn wrap_path<P>(self, path: P) -> Selfwhere
P: IntoIterator<Item = PathErrorStep>,
pub fn wrap_path<P>(self, path: P) -> Selfwhere
P: IntoIterator<Item = PathErrorStep>,
Wraps the error with a path.
§Panics
Will panic if trying to wrap error path for error types that don’t support path wrapping.
Sourcepub fn insert_path<P>(self, path: P, index: usize) -> Selfwhere
P: IntoIterator<Item = PathErrorStep>,
pub fn insert_path<P>(self, path: P, index: usize) -> Selfwhere
P: IntoIterator<Item = PathErrorStep>,
Inserts a path at the specified index.
§Panics
Will panic if trying to insert error path for error types that don’t support path insertion.
Sourcepub fn wrap_field<F: Display>(self, field: F) -> Self
pub fn wrap_field<F: Display>(self, field: F) -> Self
Wraps the error with a field.
Sourcepub fn wrap_index(self, index: usize) -> Self
pub fn wrap_index(self, index: usize) -> Self
Wraps error with an index.
Sourcepub fn wrap_field_index<F>(self, field: F, index: usize) -> Selfwhere
F: Display,
pub fn wrap_field_index<F>(self, field: F, index: usize) -> Selfwhere
F: Display,
Wraps error with a field and index.
Sourcepub fn wrap_field_key<F, K>(self, field: F, key: K) -> Self
pub fn wrap_field_key<F, K>(self, field: F, key: K) -> Self
Wraps error with a field and key.
Sourcepub fn wrap_request<N: Display>(self, name: N) -> Self
pub fn wrap_request<N: Display>(self, name: N) -> Self
Wraps error for a request.
Trait Implementations§
Source§impl Debug for RequestError
impl Debug for RequestError
Source§impl Display for RequestError
impl Display for RequestError
Source§impl Error for RequestError
impl Error for RequestError
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<&RequestError> for Status
impl From<&RequestError> for Status
Source§fn from(err: &RequestError) -> Self
fn from(err: &RequestError) -> Self
Converts to this type from the input type.
Source§impl From<DecodeError> for RequestError
impl From<DecodeError> for RequestError
Source§fn from(source: DecodeError) -> Self
fn from(source: DecodeError) -> Self
Converts to this type from the input type.
Source§impl From<EncodeError> for RequestError
impl From<EncodeError> for RequestError
Source§fn from(source: EncodeError) -> Self
fn from(source: EncodeError) -> Self
Converts to this type from the input type.
Source§impl From<PathError> for RequestError
impl From<PathError> for RequestError
Source§impl From<RequestError> for Status
impl From<RequestError> for Status
Source§fn from(err: RequestError) -> Self
fn from(err: RequestError) -> Self
Converts to this type from the input type.
Source§impl<T: 'static + GenericError + Send + Sync> From<T> for RequestError
impl<T: 'static + GenericError + Send + Sync> From<T> for RequestError
Auto Trait Implementations§
impl Freeze for RequestError
impl !RefUnwindSafe for RequestError
impl Send for RequestError
impl Sync for RequestError
impl Unpin for RequestError
impl !UnwindSafe for RequestError
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T, U> RequestParseInto<U> for Twhere
U: RequestParse<T>,
impl<T, U> RequestParseInto<U> for Twhere
U: RequestParse<T>,
Source§fn parse_into(self) -> Result<U, RequestError>
fn parse_into(self) -> Result<U, RequestError>
Parses self into another type. Read more