TsgcHTTP3Server › 事件 › OnH3Exception
在处理 HTTP/3 连接时发生未处理异常时触发。
property OnH3Exception: TsgcQUICServerExceptionEvent;
// TsgcQUICServerExceptionEvent = procedure(Sender: TObject; const aConnection: TsgcQUICServerConnection; const aException: Exception) of object
—
| 名称 | 类型 | 描述 |
|---|---|---|
aConnection | const TsgcQUICServerConnection | 引发异常的 QUIC 连接。对于不与单个连接关联的错误,可能为 nil。 |
aException | Exception | 捕获到的异常。 |
OnH3Exception 在服务器处理某条连接的 QUIC/HTTP/3 流量时发生未处理异常时触发,例如在握手、帧解析、请求分发或响应写入期间。处理此事件可让应用程序记录故障并保持服务器运行,因为错误被隔离到受影响的连接,而不会终止监听器。
使用 aConnection 参数在可用时标识相关对等方,并读取 aException.Message 获取错误详情。
procedure OnH3ExceptionEvent(Sender: TObject; const aConnection:
TsgcQUICServerConnection; const aException: Exception);
begin
Log('HTTP/3 error: ' + aException.Message);
end;