A protocol-neutral error with JSON-RPC-compatible defaults.
Summary
Functions
Builds an application authorization refusal.
Wraps a failure reason as an execution error.
Builds an internal error: code -32603, kind :execution.
Builds an invalid params error: code -32602, kind :protocol.
Builds a JSON-RPC invalid request error: code -32600, kind :json_rpc.
Builds a method-not-found error for method: code -32601, kind :protocol,
message "Method not found: <method>".
Builds a JSON-RPC parse error: code -32700, kind :json_rpc.
Returns the JSON-RPC error object: "code", "message", and "data" when
data is not nil. kind and cause are not included.
Types
Functions
Builds an application authorization refusal.
code is the application's own choice; JSON-RPC reserves -32000..-32099 for
implementation-defined server errors. snodo never invents one.
Wraps a failure reason as an execution error.
An Snodo.Error is returned unchanged. Any other reason becomes code
-32603 with the message "Tool execution failed", kind :execution, and
reason in the cause field, which to_json_rpc/1 leaves out.
Builds an internal error: code -32603, kind :execution.
cause is kept in the struct's cause field. to_json_rpc/1 leaves it
out, so it is not sent to the client.
Builds an invalid params error: code -32602, kind :protocol.
data, when not nil, is sent as the error's "data" and must be a JSON
value. Return this from a handler when the request should fail as a
JSON-RPC error, for example a resource that does not exist.
Builds a JSON-RPC invalid request error: code -32600, kind :json_rpc.
Builds a method-not-found error for method: code -32601, kind :protocol,
message "Method not found: <method>".
Builds a JSON-RPC parse error: code -32700, kind :json_rpc.
Returns the JSON-RPC error object: "code", "message", and "data" when
data is not nil. kind and cause are not included.