Class ExecutionException

java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.exonum.binding.core.service.ExecutionException
All Implemented Interfaces:
java.io.Serializable

public class ExecutionException
extends java.lang.RuntimeException
An error occurred during the execution of a Service method. The execution exception includes an integer error code, that may be either service-specific or operation-specific; and an optional description — an exception message. Different error codes allow the clients of the operation to distinguish between different error conditions.

Exonum translates this exception into an Errors.ExecutionError type with error kind equal to Errors.ErrorKind.SERVICE. The execution error copies the error code and the description from this exception. Exonum saves it into the database in the registry of call errors. Note that 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. They are used for logging only.

Requesting Execution Errors

An execution error, including the error code and description, can be requested:

See Also:
Blockchain.getTxResult(HashCode), Blockchain.getCallRecords(long), Errors.ExecutionStatus, ExecutionPreconditions, Serialized Form
  • Constructor Summary

    Constructors 
    Constructor Description
    ExecutionException​(byte errorCode)
    Constructs a new transaction exception with no description.
    ExecutionException​(byte errorCode, java.lang.String description)
    Constructs a new transaction exception with the specified description.
    ExecutionException​(byte errorCode, java.lang.String description, java.lang.Throwable cause)
    Constructs a new transaction exception with the specified description and cause.
  • Method Summary

    Modifier and Type Method Description
    byte getErrorCode()
    Returns the transaction error code.
    java.lang.String toString()
    Returns a string representation of this error.

    Methods inherited from class java.lang.Throwable

    addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • ExecutionException

      public ExecutionException​(byte errorCode)
      Constructs a new transaction exception with no description.
      Parameters:
      errorCode - the transaction error code
      See Also:
      ExecutionPreconditions.checkExecution(boolean, byte)
    • ExecutionException

      public ExecutionException​(byte errorCode, @Nullable java.lang.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.
      See Also:
      ExecutionPreconditions.checkExecution(boolean, byte, Object)
    • ExecutionException

      public ExecutionException​(byte errorCode, @Nullable java.lang.String description, @Nullable java.lang.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.
      See Also:
      Errors.ExecutionError.getCode()
    • toString

      public java.lang.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 java.lang.Throwable