Skip to content

fix: dereference error in UnmarshalJSON for BatchCall - #187

Merged
pkieltyka merged 1 commit into
masterfrom
consistent-jsonerr
Oct 7, 2025
Merged

pkieltyka merged 1 commit into
masterfrom
consistent-jsonerr

Conversation

@klaidliadon

Copy link
Copy Markdown
Contributor

While testing some endpoints I found that I could not use errors.As with jsonrpc.Error consistently. After some debugging I found the cause: in some parts jsonrpc.Error is returned, while BatchCall uses *jsonrpc.Error.

This PR makes the type consistent.

This:

func handleRPCError(t *testing.T, err error) {
	if jsonErr := (&jsonrpc.Error{}); errors.As(err, jsonErr) || errors.As(err, &jsonErr) {
		if jsonErr.Code == -32000 {
			t.Skipf("skipping: %s", err)
		}
	}
}

Becomes:

func handleRPCError(t *testing.T, err error) {
	if jsonErr := (&jsonrpc.Error{}); errors.As(err, jsonErr) {
		if jsonErr.Code == -32000 {
			t.Skipf("skipping: %s", err)
		}
	}
}

@pkieltyka
pkieltyka merged commit a47c1eb into master Oct 7, 2025
8 checks passed
@pkieltyka
pkieltyka deleted the consistent-jsonerr branch October 7, 2025 20:06
@VojtechVitek

Copy link
Copy Markdown
Contributor

Nice catch, thank you :) ✅

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.

3 participants