Package com.tuladb
Class LedgerClient.LedgerProtocolException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.io.IOException
com.tuladb.LedgerClient.LedgerProtocolException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
LedgerClient.LedgerAuthException,LedgerClient.LedgerStatusException
- Enclosing class:
LedgerClient
A reply that is not a successful answer, as distinct from a transport
failure. Two cases, told apart by
statusCode():
- An engine status (
statusCode() != null): a RESP_ERROR frame carrying its status, or the declined item of a single write. Always thrown as the subclassLedgerClient.LedgerStatusException-- catch that type to handle engine statuses. Its status class is final (never retry), retryable (back off, retry with the same identity) or other. - A protocol error (
statusCode() == null, thrown as this class itself): a frame that is not an engine answer -- an unexpected msg_type, or a RESP_ERROR too short to carry a status. The socket is reset and the request's outcome is unknown, as after a transport failure; it never reads as status 0.
LedgerClient.LedgerStatusException
extends it, so existing catch (LedgerProtocolException e) blocks
keep catching engine statuses unchanged. Subclasses IOException for
source compatibility with existing catch blocks.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionLedgerProtocolException(String message) LedgerProtocolException(String message, int msgType, Integer statusCode) LedgerProtocolException(String message, int msgType, Integer statusCode, Object result) result: a declined single write's decoded item result, or null. -
Method Summary
Modifier and TypeMethodDescriptionbooleanLedgerClient.statusIsAmbiguous(int)ofstatusCode(): the write may have committed; retry only with the same identity.booleanisFinal()LedgerClient.statusIsFinal(int)ofstatusCode(); false when there is no status.booleanLedgerClient.statusIsRetryable(int)ofstatusCode(): nothing was written; back off and retry with the same identity.intmsgType()The response frame's msg_type, or -1 when not known.result()A declined single write's decoded item result -- aModels.TransferResultorModels.TieredTransferResult(phase, batch_seq, balances of the decline) -- or null when the failure carried none (a whole-frame error, transport, account create).The engine's LedgerStatus from the RESP_ERROR payload, or null when the frame did not carry one.LedgerClient.statusName(int)ofstatusCode(), or null.Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
LedgerProtocolException
-
LedgerProtocolException
-
LedgerProtocolException
result: a declined single write's decoded item result, or null.
-
-
Method Details
-
result
A declined single write's decoded item result -- aModels.TransferResultorModels.TieredTransferResult(phase, batch_seq, balances of the decline) -- or null when the failure carried none (a whole-frame error, transport, account create). -
msgType
public int msgType()The response frame's msg_type, or -1 when not known. -
statusCode
The engine's LedgerStatus from the RESP_ERROR payload, or null when the frame did not carry one. Branch on this, not on the message. -
statusName
LedgerClient.statusName(int)ofstatusCode(), or null. -
isFinal
public boolean isFinal()LedgerClient.statusIsFinal(int)ofstatusCode(); false when there is no status. -
isRetryable
public boolean isRetryable()LedgerClient.statusIsRetryable(int)ofstatusCode(): nothing was written; back off and retry with the same identity. -
isAmbiguous
public boolean isAmbiguous()LedgerClient.statusIsAmbiguous(int)ofstatusCode(): the write may have committed; retry only with the same identity.
-