Class ExecutionException

  • All Implemented Interfaces:
    Serializable

    public class ExecutionException
    extends 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 Detail

      • ExecutionException

        public ExecutionException​(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 Detail

      • getErrorCode

        public final byte getErrorCode()
        Returns the transaction error code.
        See Also:
        Errors.ExecutionError.getCode()
      • 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