TsgcWebSocketLoadBalancerServerEvents › OnException

OnException Event

Fires when an unhandled Delphi exception is caught by the load balancer while processing a connection.

Syntax

property OnException: TsgcExceptionEvent;
// TsgcExceptionEvent = procedure(Connection: TsgcWSConnection; E: Exception) of object

Default Value

Remarks

OnException is raised when an exception propagates out of the internal dispatch pipeline, typically from a user event handler, from the forwarder, or from the underlying Indy I/O code. Connection is the affected session and E is the exception instance; the exception is swallowed by the server after the event returns so the connection thread can continue servicing other requests. Read E.ClassName and E.Message for logging; do not re-raise.

Example


procedure OnException(Connection: TsgcWSConnection; E: Exception);
begin
  Log(Format('Exception %s on %s: %s',
    [E.ClassName, Connection.Guid, E.Message]));
end;

Back to Events