JSON-RPC / MCP error representation.
An Urchin.Error is both a struct and an exception, so handlers may either return
{:error, Urchin.Error.t()} or raise it. The dispatcher converts it into a
JSON-RPC error object on the wire.
Summary
Functions
JSON-RPC internal error (-32603).
JSON-RPC invalid params (-32602).
JSON-RPC invalid request (-32600): the payload is not a valid request object.
JSON-RPC method not found (-32601).
Code constant for method_not_found.
Builds an error with an explicit numeric code.
JSON-RPC parse error (-32700): invalid JSON was received.
Serializes the error into the JSON-RPC error object shape. The data member
is omitted when nil.
Code constant for the URL-elicitation-required error.
Coerces an arbitrary value raised or returned by user code into an Urchin.Error.
Types
Functions
JSON-RPC internal error (-32603).
JSON-RPC invalid params (-32602).
JSON-RPC invalid request (-32600): the payload is not a valid request object.
JSON-RPC method not found (-32601).
@spec method_not_found_code() :: integer()
Code constant for method_not_found.
Builds an error with an explicit numeric code.
JSON-RPC parse error (-32700): invalid JSON was received.
Serializes the error into the JSON-RPC error object shape. The data member
is omitted when nil.
@spec url_elicitation_required_code() :: integer()
Code constant for the URL-elicitation-required error.
Coerces an arbitrary value raised or returned by user code into an Urchin.Error.
Urchin.Error values pass through unchanged. Everything else becomes an internal
error so that exceptions never leak transport details to the client.