TsgcHTTP_API_Anthropic › Events › OnHTTPAPIException
Fires when a call to the Anthropic API raises an unhandled exception
property OnHTTPAPIException: TsgcHTTPAPIExceptionEvent;
// TsgcHTTPAPIExceptionEvent = procedure(Sender: TObject; E: Exception) of object
—
This event is triggered whenever a request sent to https://api.anthropic.com/v1 fails with an exception, for example network errors, TLS failures, HTTP non-2xx status codes (401, 429, 5xx) or JSON parsing errors. The exception is also reported through the regular try/except path, so this event is primarily useful for centralized logging or telemetry. Inspect the E parameter for the underlying message and class.
procedure TForm1.oAPIHTTPAPIException(Sender: TObject; E: Exception);
begin
Memo1.Lines.Add('Anthropic error: ' + E.ClassName + ' - ' + E.Message);
end;