TsgcWSPClient_sgc事件 › OnRPCError

OnRPCError 事件

当服务器对 RPC 请求返回错误响应时触发。

语法

property OnRPCError: TsgcWSRPCErrorEvent;
// TsgcWSRPCErrorEvent = procedure(Connection: TsgcWSConnection; Id: string; ErrorCode: integer; ErrorMessage, ErrorData: string) of object

默认值

备注

Id 与传递给 RPC 的值匹配。ErrorCode 是服务器返回的数字代码,ErrorMessage 是简短描述,ErrorData 是可选的扩展信息(通常为 JSON)。待处理条目将自动从 RPC 列表中移除。

示例

procedure TForm1.oProtocolRPCError(Connection: TsgcWSConnection; Id: string;
  ErrorCode: integer; ErrorMessage, ErrorData: string);
begin
  Memo1.Lines.Add(Format('rpc %s error %d: %s', [Id, ErrorCode, ErrorMessage]));
end;

返回事件