[−][src]Struct exonum::runtime::error::ExecutionError
Result of unsuccessful runtime execution.
An execution error consists of an error kind and optional description. The error code affects the blockchain state hash, while the description does not. Therefore descriptions are mostly used for developer purposes, not for interaction of the system with users.
Usually you can implement conversion from your own error type to the ExecutionError
via
deriving IntoExecutionError
from exonum-derive
crate.
This macro implements From<MyError> for ExecutionError
conversion for the given enum.
Enumeration should have an explicit discriminant for each error kind.
Derives Display
and Fail
traits using documentation comments for each error kind.
Examples
Deriving errors in service transactions:
use exonum_derive::IntoExecutionError; /// Error codes emitted by wallet transactions during execution: #[derive(Debug, IntoExecutionError)] pub enum Error { /// Content hash already exists. HashAlreadyExists = 0, /// Unable to parse the service configuration. ConfigParseError = 1, /// Time service with the specified name does not exist. TimeServiceNotFound = 2, }
Deriving errors in runtimes:
use exonum_derive::IntoExecutionError; // Define runtime specific errors. #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, IntoExecutionError)] #[execution_error(kind = "runtime")] enum SampleRuntimeError { /// Incorrect information to call the transaction. IncorrectCallInfo = 1, /// Incorrect transaction payload. IncorrectPayload = 2, }
Fields
kind: ErrorKind
The kind of error that indicates in which module and with which code the error occurred.
description: String
Optional description which doesn't affect object_hash
.
Methods
impl ExecutionError
[src]
pub fn new(kind: ErrorKind, description: impl Into<String>) -> Self
[src]
Creates a new execution error instance with the specified error kind and an optional description.
Trait Implementations
impl From<Error> for ExecutionError
[src]
impl<E, T> From<(E, T)> for ExecutionError where
T: Display,
E: Into<ErrorKind>,
[src]
T: Display,
E: Into<ErrorKind>,
impl From<Error> for ExecutionError
[src]
impl Clone for ExecutionError
[src]
fn clone(&self) -> ExecutionError
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Eq for ExecutionError
[src]
impl Ord for ExecutionError
[src]
fn cmp(&self, other: &ExecutionError) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
fn min(self, other: Self) -> Self
1.21.0[src]
fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<ExecutionError> for ExecutionError
[src]
fn eq(&self, other: &ExecutionError) -> bool
[src]
fn ne(&self, other: &ExecutionError) -> bool
[src]
impl PartialOrd<ExecutionError> for ExecutionError
[src]
fn partial_cmp(&self, other: &ExecutionError) -> Option<Ordering>
[src]
fn lt(&self, other: &ExecutionError) -> bool
[src]
fn le(&self, other: &ExecutionError) -> bool
[src]
fn gt(&self, other: &ExecutionError) -> bool
[src]
fn ge(&self, other: &ExecutionError) -> bool
[src]
impl Debug for ExecutionError
[src]
impl Display for ExecutionError
[src]
impl Hash for ExecutionError
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl StructuralPartialEq for ExecutionError
[src]
impl StructuralEq for ExecutionError
[src]
impl Fail for ExecutionError
[src]
fn name(&self) -> Option<&str>
[src]
fn cause(&self) -> Option<&dyn Fail>
[src]
fn backtrace(&self) -> Option<&Backtrace>
[src]
fn context<D>(self, context: D) -> Context<D> where
D: Display + Send + Sync + 'static,
[src]
D: Display + Send + Sync + 'static,
fn compat(self) -> Compat<Self>
[src]
impl BinaryValue for ExecutionError
[src]
fn to_bytes(&self) -> Vec<u8>
[src]
fn from_bytes(value: Cow<[u8]>) -> Result<Self, Error>
[src]
fn into_bytes(self) -> Vec<u8>
[src]
impl ObjectHash for ExecutionError
[src]
fn object_hash(&self) -> Hash
[src]
impl ProtobufConvert for ExecutionError
[src]
type ProtoStruct = ExecutionError
Type of the protobuf clone of Self
fn to_pb(&self) -> Self::ProtoStruct
[src]
fn from_pb(pb: Self::ProtoStruct) -> Result<Self, Error>
[src]
Auto Trait Implementations
impl Send for ExecutionError
impl Sync for ExecutionError
impl Unpin for ExecutionError
impl UnwindSafe for ExecutionError
impl RefUnwindSafe for ExecutionError
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
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<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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> AsFail for T where
T: Fail,
[src]
T: Fail,
impl<E> Fail for E where
E: 'static + Error + Send + Sync,
[src]
E: 'static + Error + Send + Sync,
fn name(&self) -> Option<&str>
[src]
fn cause(&self) -> Option<&(dyn Fail + 'static)>
[src]
fn backtrace(&self) -> Option<&Backtrace>
[src]
fn context<D>(self, context: D) -> Context<D> where
D: Display + Send + Sync + 'static,
[src]
D: Display + Send + Sync + 'static,
fn compat(self) -> Compat<Self>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,
fn vzip(self) -> V
impl<T> Erased for T
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,