Class TransactionExecutionException

java.lang.Object
java.lang.Throwable
java.lang.Exception
com.exonum.binding.core.transaction.TransactionExecutionException
All Implemented Interfaces:
Serializable

public class TransactionExecutionException
extends Exception
An exception occurred during transaction execution. The transaction exception includes an integer error code, that may be either service-specific or transaction-specific; and an optional description — an exception message. Both the error code and the description are saved in the database, but only the value of the error code affects the blockchain state.

The other attributes of a Java exception — a stack trace, a cause, suppressed exceptions — are not saved in the database and are used for logging only.

An external client will get the error code and description when requests a transaction status of a failed transaction. See the API endpoint documentation for more information.

See Also:
Blockchain.getTxResult(HashCode), Blockchain.getTxResults(), Runtime.ExecutionStatus, Serialized Form
  • Constructor Details

    • TransactionExecutionException

      public TransactionExecutionException​(byte errorCode)
      Constructs a new transaction exception with no description.
      Parameters:
      errorCode - the transaction error code
    • TransactionExecutionException

      public TransactionExecutionException​(byte errorCode, @Nullable String description)
      Constructs a new transaction exception with the specified description.
      Parameters:
      errorCode - the transaction error code
      description - the error description. The detail description is saved for later retrieval by the Throwable.getMessage() method.
    • TransactionExecutionException

      public TransactionExecutionException​(byte errorCode, @Nullable String description, @Nullable Throwable cause)
      Constructs a new transaction exception with the specified description and cause.

      Note that the detail message associated with cause is not automatically incorporated in this exception’s detail message.

      Parameters:
      errorCode - the transaction error code
      description - the error description. The detail description is saved for later retrieval by the Throwable.getMessage() method.
      cause - the cause (which is saved for later retrieval by the Throwable.getCause() method). A null value is permitted, and indicates that the cause is nonexistent or unknown.
  • Method Details

    • getErrorCode

      public final byte getErrorCode()
      Returns the transaction error code.
    • toString

      public String toString()
      Returns a string representation of this error. Includes the actual class name, the optional description and the error code.
      Overrides:
      toString in class Throwable