TsgcHTTP2Client › Events › OnHTTP2Exception
Fires when an exception is raised on the HTTP/2 connection so the application can handle it.
property OnHTTP2Exception: TsgcHTTP2ClientExceptionEvent;
// TsgcHTTP2ClientExceptionEvent = procedure(Sender: TObject; const Connection: TsgcHTTP2ConnectionClient; const E: Exception) of object
—
OnHTTP2Exception is raised when any exception is caught inside the HTTP/2 read / write loop or during the TLS handshake, for example a socket error, a TLS failure, a malformed frame from the server or a protocol violation. The E parameter gives access to the exception message and class so it can be logged or mapped to application-level errors; the Connection parameter identifies the affected session. The exception is swallowed once the event returns so the client can keep processing; if the error is fatal the connection is closed and OnHTTP2Disconnect follows.
procedure OnHTTP2ExceptionEvent(Sender: TObject; const Connection: TsgcHTTP2ConnectionClient;
const E: Exception);
begin
Log('HTTP/2 error: ' + E.ClassName + ' - ' + E.Message);
end;