TsgcHTTP_API_OpenAI › Events › OnHTTPAPIException
Fires when an uncaught exception is raised during an OpenAI REST call
property OnHTTPAPIException: TsgcHTTPAPIExceptionEvent;
// TsgcHTTPAPIExceptionEvent = procedure(Sender: TObject; E: Exception) of object
—
Triggered whenever an exception propagates out of any of the REST wrappers (Chat Completions, Responses, Images, Audio, Embeddings, etc.) before it reaches the caller. Typical causes are network failures, TLS handshake errors, HTTP status codes returned as exceptions, and malformed JSON payloads. Inspect E.ClassName and E.Message to log or transform the error, and optionally re-raise from your handler if you want the caller to see it. Use this event as a single centralized place to surface diagnostics from every OpenAI endpoint.
procedure TForm1.oAPIHTTPAPIException(Sender: TObject; E: Exception);
begin
ShowMessage('OpenAI error [' + E.ClassName + ']: ' + E.Message);
end;