Skip to main content
JSON-RPC error type and standardized error codes following JSON-RPC 2.0 and EIP-1474 specifications.

Type Definition

Quick Start

Error Code Constants

Standard JSON-RPC 2.0

Ethereum-Specific (EIP-1474)

Server error range: -32000 to -32099

API Reference

from()

Create error from code and message:
Parameters:
  • code: number | JsonRpcErrorType - Error code or error object
  • message?: string - Error message
  • data?: unknown - Additional error data
Returns: JsonRpcErrorType

toString()

Format error as string:
Parameters:
  • error: JsonRpcErrorType - Error object
Returns: 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