Skip to content

feat: add parameter context to errors#160

Open
2wheeh wants to merge 4 commits intowevm:mainfrom
2wheeh:feat/error-parameter
Open

feat: add parameter context to errors#160
2wheeh wants to merge 4 commits intowevm:mainfrom
2wheeh:feat/error-parameter

Conversation

@2wheeh
Copy link

@2wheeh 2wheeh commented Jan 28, 2026

Description

When ABI encoding fails, the error contains no information about which parameter caused the failure.

This makes it difficult to programmatic error handling. Ex, mapping errors to specific form fields.

Changes

  • adds parameter: AbiParameter field to encoding-related error classes.

Usage

Form Integration

function parseEncodingError(error: unknown) {
  if (error instanceof Address.InvalidAddressError && error.parameter) {
    return {
      field: error.parameter.name,
      message: `${error.parameter.name} must be a valid address`,
    }
  }
  if (error instanceof Hex.IntegerOutOfRangeError && error.parameter) {
    return {
      field: error.parameter.name,
      message: `${error.parameter.name} is out of range`,
    }
  }
  // ... 
}

@vercel
Copy link

vercel bot commented Jan 28, 2026

@2wheeh is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant