Skip to main content
Error wrapping standard for adding context to reverted external calls.
Implements ERC-7751 wrapping of errors with call context.

Overview

ERC-7751 defines a standard error for wrapping revert reasons from external calls with additional context about the call that failed. Useful for:
  • Debugging complex multi-contract interactions
  • Preserving original error while adding call context
  • Standardized error wrapping across protocols

WrappedError Format

API

encodeWrappedError

encodeWrappedError(params: WrappedErrorParams): Uint8Array Encodes a wrapped error with context. Parameters:
Example:

decodeWrappedError

decodeWrappedError(data: Uint8Array): WrappedErrorData Decodes a wrapped error to extract context. Returns:
Example:

Usage Patterns

Contract Error Handler

Error Tracer

Constants

WRAPPED_ERROR_SELECTOR

4-byte selector for WrappedError(address,bytes4,bytes,bytes).

Specification

Defined in: src/primitives/Abi/error/wrapped/ See also: