TsgcHTTPServer › Events › OnError

OnError Event

Fires whenever a protocol-level error occurs while processing a client connection, such as a mal-formed HTTP request.

Syntax

property OnError: TsgcWSErrorEvent;
// TsgcWSErrorEvent = procedure(Connection: TsgcWSConnection; const Error: string) of object

Default Value

—

Remarks

OnError reports protocol-level problems detected while parsing a client connection, such as a mal-formed request line or an invalid header. The Error parameter contains a textual description and the Connection parameter identifies the offending session. Errors raised while dispatching HTTP requests from OnCommandGet / OnCommandOther are routed through OnException; OnError is reserved for the connection/protocol-parsing side of the server.

Example


procedure OnError(Connection: TsgcWSConnection; const Error: string);
begin
  WriteLn('#error on ' + Connection.Guid + ': ' + Error);
end;

Back to Events