Reading Errors in the Wire
Decode error codes and messages when calls fail.
When Calls Go Wrong
Not every request succeeds. When something fails, JSON-RPC sends back an error object instead of a result, and reading it is your fastest path to a fix.
The error Object
An error response keeps the request id but swaps result for an error object holding a code and a message.
{"jsonrpc": "2.0", "id": 3,
"error": {"code": -32601, "message": "Method not found"}}All lessons in this course
- Requests, Responses & Notifications
- Anatomy of a JSON-RPC Call
- The Initialize Handshake
- Reading Errors in the Wire