Reference
Error handling
All hooks return error: DecaneError | null. Branch on error.code instead of parsing error strings.
tsx
import { DecaneError, DecaneErrorCode } from "decane-connect-kit";
if (error) {
switch (error.code) {
case DecaneErrorCode.USER_REJECTED:
break;
case DecaneErrorCode.NO_ACTIVE_SESSION:
break;
default:
console.error(error.message);
}
}Error codes
| Code | Value | When thrown |
|---|---|---|
| USER_REJECTED | 4001 | User dismissed the wallet prompt |
| UNAUTHORIZED | 4100 | Wallet refused the request |
| NO_ACTIVE_SESSION | 5001 | Signing called before connecting |
| SCOPE_MISMATCH | 5002 | Account not in session scope |
| SESSION_EXPIRED | 5003 | Session is no longer valid |
| UNSUPPORTED_CHAIN | 5010 | Chain ID not in registry |
| CHAIN_NOT_IN_SCOPE | 5011 | Chain not granted in session |
| INVALID_CHAIN_CONFIG | 5012 | Custom chain descriptor is malformed |
| NO_WALLET_CONNECTED | 5020 | Action requires a connected wallet |
| WALLET_DISCONNECTED | 5021 | Wallet disconnected mid-session |
| PROVIDER_ERROR | 5022 | Underlying wallet threw an error |
| METHOD_NOT_SUPPORTED | 5030 | Method not recognised |
| EVM_ONLY_METHOD | 5031 | wallet_signTypedData on a non-EVM chain |