Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jsonrpc error check #136

Merged
merged 3 commits into from
Sep 3, 2024
Merged

jsonrpc error check #136

merged 3 commits into from
Sep 3, 2024

Conversation

klaidliadon
Copy link
Contributor

Parsing error as jsonrpc.Message and return the parsed error when possible.

The parsed error would be shown in the logs as:

ethrpc: request fail: jsonrpc error -32002: Public rate limit reached -- please visit https://sequence.build to setup your project and access key to increase your limits.

Copy link
Contributor

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines +118 to +120
if err := json.Unmarshal(body, &msg); err == nil && msg.Error != nil {
return body, superr.Wrap(ErrRequestFail, msg.Error)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great catch!!

ethrpc/ethrpc.go Outdated
Comment on lines 121 to 122
if len(body) > 100 {
body = body[:100]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you append "..." or "... [RETRACTED]" to this body too, please?

Copy link
Contributor

@VojtechVitek VojtechVitek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@VojtechVitek VojtechVitek merged commit d41fe41 into master Sep 3, 2024
8 checks passed
@VojtechVitek VojtechVitek deleted the jsonrpc-error branch September 3, 2024 18:37
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