Skip to content

ethrpc: preserve non-batch errors in BatchCall#213

Open
pengqima wants to merge 1 commit into
0xsequence:masterfrom
pengqima:master
Open

ethrpc: preserve non-batch errors in BatchCall#213
pengqima wants to merge 1 commit into
0xsequence:masterfrom
pengqima:master

Conversation

@pengqima

Copy link
Copy Markdown

Preserve the original error returned by Provider.Do when BatchCall receives an error that is not a BatchError.

The previous type assertion reused the name err:

if err, ok := err.(BatchError); ok {

When the assertion failed, the else branch referred to the zero value produced by the failed assertion instead of the original error. This resulted in an empty error such as:

unable to batch call:

It also prevented callers from inspecting the underlying error with errors.Is.

The asserted value is now named batchErr, allowing the non-batch branch to wrap the original error. Existing BatchError handling remains unchanged.

A regression test uses a failing HTTP client to verify that the transport error remains in the returned error chain.

Signed-off-by: pengqima <pengqima@outlook.com>
@pengqima
pengqima requested a review from a team July 16, 2026 13:47
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