[−][src]Struct exonum::runtime::ErrorMatch
Matcher for ExecutionError
s that can have some fields unspecified. Can be compared to
an ExceptionError
, e.g., in tests. The unspecified fields will match any value in the error.
Examples
use exonum::runtime::{ExecutionError, InstanceId, ErrorMatch}; use exonum_derive::ExecutionFail; #[derive(Debug, ExecutionFail)] pub enum Error { /// Content hash already exists. HashAlreadyExists = 0, // other variants... } // Identifier of the service that will cause an error. const SERVICE_ID: InstanceId = 100; let err: &ExecutionError = // ... let matcher = ErrorMatch::from_fail(&Error::HashAlreadyExists) .for_service(SERVICE_ID); assert_eq!(*err, matcher);
Methods
impl ErrorMatch
[src]
pub fn from_fail<F: ExecutionFail + ?Sized>(fail: &F) -> Self
[src]
Creates a matcher from the provided error.
The converted error has a kind and description set to the values returned
by the corresponding methods of the ExecutionFail
trait. The call site information
(e.g., the instance ID) is not set.
pub fn any_unexpected() -> Self
[src]
Creates a matcher for Unexpected
kind of errors.
By default it will match any description.
pub fn with_any_description(self) -> Self
[src]
Accepts an error with any description.
pub fn with_description_containing(self, pat: impl Into<String>) -> Self
[src]
Accepts an error with any description containing the specified string.
pub fn with_description_matching<P>(self, pat: P) -> Self where
P: Fn(&str) -> bool + 'static,
[src]
P: Fn(&str) -> bool + 'static,
Accepts an error with any description matching the specified closure.
pub fn in_runtime(self, runtime_id: u32) -> Self
[src]
Accepts an error that has occurred in a runtime with the specified ID.
pub fn for_service(self, instance_id: InstanceId) -> Self
[src]
Accepts an error that has occurred in a service with the specified ID.
pub fn in_call(self, call_type: CallType) -> Self
[src]
Accepts an error that has occurred in a call of the specified format.
Trait Implementations
impl Debug for ErrorMatch
[src]
impl PartialEq<ErrorMatch> for ExecutionError
[src]
fn eq(&self, error_match: &ErrorMatch) -> bool
[src]
#[must_use]fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
impl PartialEq<ExecutionError> for ErrorMatch
[src]
Auto Trait Implementations
impl !RefUnwindSafe for ErrorMatch
impl !Send for ErrorMatch
impl !Sync for ErrorMatch
impl Unpin for ErrorMatch
impl !UnwindSafe for ErrorMatch
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,