[−][src]Struct exonum::blockchain::TransactionError
Result of unsuccessful transaction execution encompassing both service and framework-wide error handling. This error indicates whether a panic or a user error has occurred.
Notes:
- Content of the
description
field is excluded from the hash calculation (seeStorageValue
implementation for the details). TransactionErrorType::Panic
is set by the framework if panic is raised during transaction execution.TransactionError
implementsDisplay
which can be used for obtaining a simple error description.
Examples
The example below creates a schema; retrieves the table with transaction results from this schema; using a hash takes the result of a certain transaction and returns a message that depends on whether the transaction is successful or not.
use exonum::blockchain::Schema; let schema = Schema::new(&snapshot); if let Some(result) = schema.transaction_results().get(&transaction_hash) { match result.0 { Ok(()) => println!("Successful transaction execution"), Err(transaction_error) => { // Prints user friendly error description. println!("Transaction error: {}", transaction_error); } } }
Methods
impl TransactionError
[src]
pub fn error_type(&self) -> TransactionErrorType
[src]
Returns an error type of this TransactionError
instance. This can be
either a panic or a user-defined error code.
pub fn description(&self) -> Option<&str>
[src]
Returns an optional error description.
Trait Implementations
impl PartialOrd<TransactionError> for TransactionError
[src]
fn partial_cmp(&self, other: &TransactionError) -> Option<Ordering>
[src]
fn lt(&self, other: &TransactionError) -> bool
[src]
fn le(&self, other: &TransactionError) -> bool
[src]
fn gt(&self, other: &TransactionError) -> bool
[src]
fn ge(&self, other: &TransactionError) -> bool
[src]
impl PartialEq<TransactionError> for TransactionError
[src]
fn eq(&self, other: &TransactionError) -> bool
[src]
fn ne(&self, other: &TransactionError) -> bool
[src]
impl From<ExecutionError> for TransactionError
[src]
fn from(error: ExecutionError) -> Self
[src]
impl Clone for TransactionError
[src]
fn clone(&self) -> TransactionError
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Ord for TransactionError
[src]
fn cmp(&self, other: &TransactionError) -> Ordering
[src]
fn max(self, other: Self) -> Self
1.21.0[src]
Compares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self
1.21.0[src]
Compares and returns the minimum of two values. Read more
impl Eq for TransactionError
[src]
impl Display for TransactionError
[src]
impl Debug for TransactionError
[src]
Auto Trait Implementations
impl Send for TransactionError
impl Sync for TransactionError
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> TryFrom 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> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto 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> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Erased for T
impl<Q, K> Equivalent for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> Same for T
type Output = T
Should always be Self