Package org.stellar.sdk.exception
package org.stellar.sdk.exception
Exceptions that can be thrown by the Stellar SDK.
The base exception class is SdkException
, which extends
RuntimeException
. All custom exceptions defined in the SDK extend SdkException
. The SDK may also throw standard Java runtime exceptions
such as IllegalArgumentException
where appropriate.
The exception hierarchy is as follows:
SdkException
The Stellar SDK uses unchecked exceptions (extending RuntimeException
) for the
following reasons:
- Stellar SDK methods may throw exceptions as a result of errors that occur in the Stellar network, which are out of the control of the SDK itself. Forcing developers to catch such exceptions would lead to cluttered code.
- Most methods in the SDK throw exceptions to indicate errors that cannot be handled by the method itself. Propagating these exceptions as unchecked exceptions allows developers to handle them at an appropriate point in their code.
- Unchecked exceptions are more suitable for an API like the Stellar SDK, where most exceptions indicate programming errors or errors in interaction with the Stellar network, rather than recoverable conditions.
While the SDK uses unchecked exceptions, developers are still encouraged to catch and handle these exceptions appropriately in their code. The specific exception classes thrown by the SDK provide useful information about the nature of the error that occurred.
- See Also:
-
ClassDescriptionException thrown when trying to load an account that doesn't exist on the Stellar network.AccountRequiresMemoException is thrown when a transaction is trying to submit an operation to an account which requires a memo.Exception thrown when a bad request is made to the server.Exception thrown when a bad response is received from the server.Connection error when trying to connect to the server.If the SEP-0010 validation fails, the exception will be thrown.Represents an exception that occurs during network operations in the Stellar SDK.Exception thrown when preparing a transaction failed.Exception thrown when a request times out.Base class for all exceptions thrown by the SDK.Throws when Soroban-RPC instance responds with error.Exception thrown when too many requests were sent to the Horizon server.This exception is thrown to indicate that an unexpected condition has occurred which theoretically should never happen during the normal execution of the program.