Skip to main content
All exceptions derive from TonConnectError (importable from ton_connect.exceptions), which carries .code (numeric RPC error code, 0 unless mapped), .message (description), and .info (extended explanation, or None). Errors surface in two ways: as the error element of the tuples returned by wait_connect() / wait_transaction() / wait_sign_data() and the error argument of event handlers, or raised directly by methods such as connect() and disconnect().

Connection and Feature Errors

Raised or delivered by the library itself:

Wallet Error Codes

Errors reported by the wallet over the bridge are mapped from their RPC code to typed exceptions: Unmapped codes produce a plain TonConnectError with .code set. To map a code yourself, TonConnectErrors.from_code(code, message) returns the corresponding typed exception instance.

Handling Errors

Check the error element of the result tuple and branch on the exception type:
The same pattern applies to wait_connect() and wait_sign_data(), and to the error argument of event handlers.
Backend verification failures (VerifyTonProof, VerifySignData, verify_ton_proof_payload) raise nacl.exceptions.BadSignatureError, not TonConnectError. See Backend Verification.