Package com.exonum.binding.core.service
Class ExecutionException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.lang.RuntimeException
-
- com.exonum.binding.core.service.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.ExecutionErrortype 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:
- by any Exonum Service, using
Blockchain.getCallRecords(long) - by an authorized Light Client, using the Exonum endpoints. For example, when the clients requests the transaction information, it will get the execution error, if it occurred. See the Explorer API endpoint documentation for more information.
- 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, String description)Constructs a new transaction exception with the specified description.ExecutionException(byte errorCode, String description, Throwable cause)Constructs a new transaction exception with the specified description and cause.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description bytegetErrorCode()Returns the transaction error code.StringtoString()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
-
-
-
-
Constructor Detail
-
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 String description)Constructs a new transaction exception with the specified description.- Parameters:
errorCode- the transaction error codedescription- the error description. The detail description is saved for later retrieval by theThrowable.getMessage()method.- See Also:
ExecutionPreconditions.checkExecution(boolean, byte, Object)
-
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
causeis not automatically incorporated in this exception’s detail message.- Parameters:
errorCode- the transaction error codedescription- the error description. The detail description is saved for later retrieval by theThrowable.getMessage()method.cause- the cause (which is saved for later retrieval by theThrowable.getCause()method). A null value is permitted, and indicates that the cause is nonexistent or unknown.
-
-