Skip to content

ProviderRpcError default runtime names disagree with exported literal aliases - #5554

Closed
mortezashojaei wants to merge 1 commit into
wevm:mainfrom
mortezashojaei:fix/provider-rpc-error-default-names
Closed

mortezashojaei wants to merge 1 commit into
wevm:mainfrom
mortezashojaei:fix/provider-rpc-error-default-names

Conversation

@mortezashojaei

@mortezashojaei mortezashojaei commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Both provider error classes now default to name: 'ProviderRpcError', matching their exported literal error aliases.

ProviderRpcError(cause, options): cause.name → 'ProviderRpcError'
EIP1193ProviderRpcError(code, message): 'Error' → 'ProviderRpcError'

The RPC wrapper retains explicit non-empty names, and subclasses retain their own names. Error codes, data, details, and causes are preserved. Includes a patch changeset.

Evidence

The diff adds regression coverage for default construction, an explicit custom name, a subclass name, and preserved error fields. It also updates the affected switchChain and watchAsset snapshots.

Before, default construction reported the cause's name or Error. The updated assertions expect ProviderRpcError. Test execution has not been independently verified in this description review.

Merge Danger

Door: two-way

Blast Radius: errors

Consumers comparing the previous default names or snapshotting error output will observe the new name. The configurable RPC wrapper can still have a custom name, so its literal alias does not describe every possible instance.

Default `types.ProviderRpcError` (`EIP1193ProviderRpcError`) and
`errors.ProviderRpcError` to the `ProviderRpcError` name their exported
`ProviderRpcErrorType` aliases declare, so a consumer comparing runtime
names does not miss them. A caller-supplied name and a subclass name still
win, and the RPC wrapper keeps its cause chaining, code, data, and details.

Add regression coverage for default construction, an explicit name, and a
subclass, and update the snapshots that observed the previous defaults.
@changeset-bot

changeset-bot Bot commented Nov 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e361bec

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
viem Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel

vercel Bot commented Nov 17, 2026

Copy link
Copy Markdown

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

A member of the Team first needs to authorize it.

jxom commented Nov 18, 2026

Copy link
Copy Markdown
Member

Thanks @mortezashojaei! Closing in favour of #5558, which keeps only the EIP1193ProviderRpcError name fix (with you as co-author). The base ProviderRpcError name logic in src/errors/rpc.ts deliberately falls back to the cause's name, the same way RpcError does, and every subclass passes its own name, so that part is left unchanged.

@jxom jxom closed this Nov 18, 2026
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.

2 participants