TsgcWSPServer_WAMPEvents › OnException

OnException Event

Fires when a Delphi exception is raised inside the server's worker threads or user event handlers.

Syntax

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

Default Value

Remarks

Provides a central hook for exceptions that would otherwise terminate a listener or dispatcher thread silently — for instance a bug in an OnCall handler, a JSON parse error against a well-formed frame, or an OS-level failure during TLS. The component catches the exception and forwards it here so the application can log the class name and message. Protocol-level conditions surfaced as plain strings go through OnError; RPC errors returned from application code go back to the caller through CallError.

Example


procedure TForm1.WAMPServerException(Connection: TsgcWSConnection;
  E: Exception);
begin
  Memo1.Lines.Add(Format('[%s] exception: %s - %s',
    [Connection.Guid, E.ClassName, E.Message]));
end;

Back to Events