SorobanRpcException

class SorobanRpcException(val errorCode: Int, errorMessage: String, val data: String? = null) : NetworkException

Exception thrown when Soroban RPC instance responds with an error.

This exception represents errors returned by the Soroban RPC server according to the JSON-RPC 2.0 specification. The error object contains a code, message, and optional data field.

Common JSON-RPC Error Codes

Standard JSON-RPC 2.0 error codes:

  • -32700 - Parse error: Invalid JSON was received by the server

  • -32600 - Invalid Request: The JSON sent is not a valid Request object

  • -32601 - Method not found: The method does not exist / is not available

  • -32602 - Invalid params: Invalid method parameter(s)

  • -32603 - Internal error: Internal JSON-RPC error

  • -32000 to -32099 - Server error: Reserved for implementation-defined server errors

Soroban-specific error codes:

  • -32001 - Transaction submission failed

  • -32002 - Transaction simulation failed

  • -32003 - Ledger entry not found

  • -32004 - Contract invocation failed

See also

Constructors

Link copied to clipboard
constructor(errorCode: Int, errorMessage: String, data: String? = null)

Properties

Link copied to clipboard
val body: String?

The raw body of the response, or null if not available

Link copied to clipboard
expect open val cause: Throwable?
Link copied to clipboard
val code: Int?

The HTTP status code of the response, or null if not applicable

Link copied to clipboard
val data: String?

Optional additional error data provided by the server

Link copied to clipboard

The JSON-RPC error code

Link copied to clipboard
open override val message: String