public class ChaincodeException
extends java.lang.RuntimeException
ChaincodeException to indicate when an error
occurs in Smart Contract logic.
When a ChaincodeException is thrown an error response will be
returned from the chaincode container containing the exception message and
payload, if specified.
ChaincodeException may be extended to provide application specific
error information. Subclasses should ensure that getPayload() returns
a serialized representation of the error in a suitable format for client
applications to process.
| Constructor and Description |
|---|
ChaincodeException()
Constructs a new
ChaincodeException with no detail message. |
ChaincodeException(java.lang.String message)
Constructs a new
ChaincodeException with the specified detail
message. |
ChaincodeException(java.lang.String message,
byte[] payload)
Constructs a new
ChaincodeException with the specified detail message
and response payload. |
ChaincodeException(java.lang.String message,
byte[] payload,
java.lang.Throwable cause)
Constructs a new
ChaincodeException with the specified detail
message, response payload and cause. |
ChaincodeException(java.lang.String message,
java.lang.String payload)
Constructs a new
ChaincodeException with the specified detail message
and response payload. |
ChaincodeException(java.lang.String message,
java.lang.String payload,
java.lang.Throwable cause)
Constructs a new
ChaincodeException with the specified detail
message, response payload and cause. |
ChaincodeException(java.lang.String message,
java.lang.Throwable cause)
Constructs a new
ChaincodeException with the specified detail message
and cause. |
ChaincodeException(java.lang.Throwable cause)
Constructs a new
ChaincodeException with the specified cause. |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
getPayload()
Returns the response payload or
null if there is no response. |
public ChaincodeException()
ChaincodeException with no detail message.public ChaincodeException(java.lang.String message)
ChaincodeException with the specified detail
message.message - the detail message.public ChaincodeException(java.lang.Throwable cause)
ChaincodeException with the specified cause.cause - the cause.public ChaincodeException(java.lang.String message,
java.lang.Throwable cause)
ChaincodeException with the specified detail message
and cause.message - the detail message.cause - the cause.public ChaincodeException(java.lang.String message,
byte[] payload)
ChaincodeException with the specified detail message
and response payload.message - the detail message.payload - the response payload.public ChaincodeException(java.lang.String message,
byte[] payload,
java.lang.Throwable cause)
ChaincodeException with the specified detail
message, response payload and cause.message - the detail message.payload - the response payload.cause - the cause.public ChaincodeException(java.lang.String message,
java.lang.String payload)
ChaincodeException with the specified detail message
and response payload.message - the detail message.payload - the response payload.public ChaincodeException(java.lang.String message,
java.lang.String payload,
java.lang.Throwable cause)
ChaincodeException with the specified detail
message, response payload and cause.message - the detail message.payload - the response payload.cause - the cause.public byte[] getPayload()
null if there is no response.
The payload should represent the chaincode error in a way that client applications written in different programming languages can interpret. For example it could include a domain specific error code, in addition to any state information which would allow client applications to respond appropriately.
null if there is no response.