pub struct TypeValidationError {
pub value: Value,
pub context: Option<Box<TypeValidationContext>>,
pub cause: Box<dyn Error + Sync + Send>,
}Expand description
A value failed schema or type validation.
Fields§
§value: ValueThe offending value.
context: Option<Box<TypeValidationContext>>Where the value came from (boxed to keep the error small).
cause: Box<dyn Error + Sync + Send>The validation error.
Implementations§
Source§impl TypeValidationError
impl TypeValidationError
Sourcepub fn new(
value: Value,
cause: impl Error + Send + Sync + 'static,
) -> TypeValidationError
pub fn new( value: Value, cause: impl Error + Send + Sync + 'static, ) -> TypeValidationError
Creates an error for value caused by cause.
Sourcepub fn with_context(self, context: TypeValidationContext) -> TypeValidationError
pub fn with_context(self, context: TypeValidationContext) -> TypeValidationError
Sets the validation context.
Sourcepub fn wrap(
value: Value,
cause: Box<dyn Error + Sync + Send>,
context: Option<TypeValidationContext>,
) -> TypeValidationError
pub fn wrap( value: Value, cause: Box<dyn Error + Sync + Send>, context: Option<TypeValidationContext>, ) -> TypeValidationError
Wraps cause unless it already is a TypeValidationError for the
same value and context, in which case it is returned unchanged.
Trait Implementations§
Source§impl Debug for TypeValidationError
impl Debug for TypeValidationError
Source§impl Display for TypeValidationError
impl Display for TypeValidationError
Source§impl Error for TypeValidationError
impl Error for TypeValidationError
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<TypeValidationError> for SchemaError
impl From<TypeValidationError> for SchemaError
Source§fn from(source: TypeValidationError) -> Self
fn from(source: TypeValidationError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl !RefUnwindSafe for TypeValidationError
impl !UnwindSafe for TypeValidationError
impl Freeze for TypeValidationError
impl Send for TypeValidationError
impl Sync for TypeValidationError
impl Unpin for TypeValidationError
impl UnsafeUnpin for TypeValidationError
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