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

Add error handling to WebSocket handleMessage function, resolves #175 #210

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

theghostmac
Copy link

Changelog:

  • I added a getJsonRpcError function in client.go to handle errors for handleMessage
  • I renamed all receivers to c (My IDE automatically fixed that, and undo was difficult).

@Davincible
Copy link

@gagliardetto right now there's no rpc error handling, would be great to have this. As an example, error that I was running into;

{"jsonrpc":"2.0","error":{"code":-32600,"message":"Batch size too large for calls using account indexes. Limit is 10"}}

@@ -172,17 +172,37 @@ func (c *Client) handleMessage(message []byte) {
// when receiving message with id. the result will be a subscription number.
// that number will be associated to all future message destine to this request

// Check for an error in the message.
if errorCode, errMsg, ok := getJsonRpcError(message); ok {
Copy link

Choose a reason for hiding this comment

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

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