TsgcWebSocketServer_HTTPAPIEvents › OnException

OnException Event

Fires whenever an unhandled exception is raised while processing a client connection.

Syntax

public event TsgcExceptionEventHandler OnException;
// delegate void TsgcExceptionEventHandler(TsgcWSConnection Connection, Exception E)

Default Value

Remarks

OnException is raised whenever an exception escapes internal processing of the HTTP API server, for example when writing to a request that the client has already dropped, when a user event handler throws, or when an HTTP.SYS call returns an unexpected error. The E parameter exposes the exception instance so the application can log the message or react to specific classes. By default a disconnection raises an exception here; set Options.RaiseDisconnectExceptions to False to suppress those disconnect-related exceptions.

Example


void OnException(TsgcWSConnection Connection, Exception E)
{
  Console.WriteLine("#exception: " + E.Message);
}

Back to Events