public abstract class TransactionResult
extends java.lang.Object
TransactionExecutionException| Modifier and Type | Class and Description |
|---|---|
static class |
TransactionResult.Type
A type of transaction execution result.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_USER_DEFINED_ERROR_CODE
The maximum allowed user-defined transaction error code.
|
static int |
SUCCESSFUL_RESULT_STATUS_CODE
The status code of a successfully executed transaction.
|
static int |
UNEXPECTED_ERROR_STATUS_CODE
The status code of transaction execution corresponding to an unexpected error
during transaction execution (some unexpected runtime exception in Java, panic in Rust).
|
| Constructor and Description |
|---|
TransactionResult() |
| Modifier and Type | Method and Description |
|---|---|
static TransactionResult |
error(int errorCode,
java.lang.String errorDescription)
Creates a transaction result corresponding to a user-defined
exception during transaction execution
(or the corresponding Error in Rust services).
|
abstract java.util.OptionalInt |
getErrorCode()
Returns an error code of a transaction if its execution resulted in a service-defined error.
|
abstract java.lang.String |
getErrorDescription()
Returns the description of a transaction if its execution resulted in an error;
or an empty string if there is no description.
|
abstract TransactionResult.Type |
getType()
Returns the type of this transaction execution result.
|
boolean |
isSuccessful()
Returns true if transaction was successful, false otherwise.
|
static TransactionResult |
successful()
Returns a transaction result corresponding to successful execution.
|
static com.google.gson.TypeAdapter<TransactionResult> |
typeAdapter(com.google.gson.Gson gson)
Provides a Gson type adapter for this class.
|
static TransactionResult |
unexpectedError(java.lang.String errorDescription)
Creates a transaction result corresponding to an unexpected error during transaction
execution (some unexpected runtime exception in Java, panic in Rust).
|
public static final int MAX_USER_DEFINED_ERROR_CODE
public static final int SUCCESSFUL_RESULT_STATUS_CODE
public static final int UNEXPECTED_ERROR_STATUS_CODE
public static TransactionResult successful()
public static TransactionResult error(int errorCode, @Nullable java.lang.String errorDescription)
errorCode - a user-defined error code; must be in range [0; 255]errorDescription - an optional error description; may be null, which is considered
as no descriptionpublic static TransactionResult unexpectedError(@Nullable java.lang.String errorDescription)
errorDescription - an optional error description; may be nullpublic abstract TransactionResult.Type getType()
Type.SUCCESS if transaction was successful
Type.ERROR if there was a service-defined error during transaction execution
Type.UNEXPECTED_ERROR if there was an unexpected error during transaction
executionpublic abstract java.util.OptionalInt getErrorCode()
OptionalInt.empty() otherwisepublic abstract java.lang.String getErrorDescription()
public boolean isSuccessful()
public static com.google.gson.TypeAdapter<TransactionResult> typeAdapter(com.google.gson.Gson gson)
TransactionResultAdapterFactoryCopyright © 2019 Exonum. All rights reserved.