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:

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: