TsgcWSPServer_sgc › Methods › RPCError
Replies to a pending RPC request with a JSON-RPC error object.
procedure RPCError(aID: String; aCode: Integer; aMessage: String; aData: String = '');
| Name | Type | Description |
|---|---|---|
aID | String | Id of the RPC request originally received by OnRPC; used to route the reply back to the calling client. |
aCode | Integer | JSON-RPC error code (for example -32601 for Method not found or an application-defined negative code). |
aMessage | String | Human-readable error message placed in the error.message field. |
aData | String | Optional implementation-defined payload placed in the error.data field; leave empty to omit it. |
Call from the OnRPC handler when the requested method cannot be fulfilled. The server looks up the connection that issued aID, removes the pending method tracker, and sends a JSON-RPC 2.0 error reply. The client surfaces it through its OnRPCError event.
oProtocol.RPCError(aID, -32602, 'Invalid params', 'missing "amount"');