[][src]Struct exonum::blockchain::TransactionError

pub struct TransactionError { /* fields omitted */ }

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 (see StorageValue implementation for the details).
  • TransactionErrorType::Panic is set by the framework if panic is raised during transaction execution.
  • TransactionError implements Display 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]

impl PartialEq<TransactionError> for TransactionError[src]

impl From<ExecutionError> for TransactionError[src]

impl Clone for 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 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

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Erased for T

impl<Q, K> Equivalent for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

impl<T> Same for T

type Output = T

Should always be Self