JSONRPCError(errCode, msg, data)JSONRPCError(errCode, msg)This class is used to represent errors that occur during the processing of JSON-RPC requests. It provides a structured way to format error responses, including an error code, message, and optional additional data. This class ensures that errors are properly formatted according to the JSON-RPC 2.0 specification and can be easily included in responses to clients.
Consider the following example. The default response doesn't include a very useful error message.
|
|
|
Let's replace it with a more useful one.
|
|
|
Note that the error codes -32000 to -32099 are reserved for use by JSON-RPC servers, so errCode should lie in this interval (although this isn't checked).
The object JSONRPCError is a self initializing type, with ancestor classes HashTable < Thing.
The source of this document is in JSONRPC.m2:406:0.