TsgcWSPServer_DatasetMethods › RPCError

RPCError Method

Replies to a pending RPC request with a JSON-RPC error object.

Syntax

procedure RPCError(aID: String; aCode: Integer; aMessage: String; aData: String = '');

Parameters

NameTypeDescription
aIDStringId of the RPC request originally received by OnRPC; used to route the reply back to the calling client.
aCodeIntegerJSON-RPC error code (for example -32601 for Method not found or an application-defined negative code).
aMessageStringHuman-readable error message placed in the error.message field.
aDataStringOptional implementation-defined payload placed in the error.data field; leave empty to omit it.

Remarks

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.

Example

oProtocol.RPCError(aID, -32602, 'Invalid params', 'missing "amount"');

Back to Methods