Type Definition
Quick Start
Error Code Constants
Standard JSON-RPC 2.0
| Code | Constant | Description |
|---|---|---|
-32700 | PARSE_ERROR | Invalid JSON received by server |
-32600 | INVALID_REQUEST | JSON is not a valid request object |
-32601 | METHOD_NOT_FOUND | Method does not exist or is not available |
-32602 | INVALID_PARAMS | Invalid method parameter(s) |
-32603 | INTERNAL_ERROR | Internal JSON-RPC error |
Ethereum-Specific (EIP-1474)
Server error range:-32000 to -32099
| Code | Constant | Description |
|---|---|---|
-32000 | INVALID_INPUT | Missing or invalid parameters (commonly “execution reverted”) |
-32001 | RESOURCE_NOT_FOUND | Requested resource not found (block, transaction, etc.) |
-32002 | RESOURCE_UNAVAILABLE | Requested resource not available (node syncing, data not ready) |
-32003 | TRANSACTION_REJECTED | Transaction creation failed |
-32004 | METHOD_NOT_SUPPORTED | Method exists but is not implemented |
-32005 | LIMIT_EXCEEDED | Request exceeds defined limit |
-32006 | JSON_RPC_VERSION_NOT_SUPPORTED | JSON-RPC protocol version not supported |
API Reference
from()
Create error from code and message:
code: number | JsonRpcErrorType- Error code or error objectmessage?: string- Error messagedata?: unknown- Additional error data
JsonRpcErrorType
toString()
Format error as string:
error: JsonRpcErrorType- Error object
string - Formatted error string
Common Patterns
Execution Reverted
The-32000 error code is most common for contract execution failures:
Error Code Checking
Error Messages Lookup
Tree-Shaking
Import only what you need:Specifications
Related
- Error Handling - Provider error handling patterns
- JsonRpcResponse - Response type with error union
- JsonRpcRequest - Request structure

