TsgcHTTP_API_AnthropicEvents › OnHTTPAPIException

OnHTTPAPIException Event

Fires when a call to the Anthropic API raises an unhandled exception

Syntax

property OnHTTPAPIException: TsgcHTTPAPIExceptionEvent;
// TsgcHTTPAPIExceptionEvent = procedure(Sender: TObject; E: Exception) of object

Default Value

Remarks

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.

Example

procedure TForm1.oAPIHTTPAPIException(Sender: TObject; E: Exception);
begin
  Memo1.Lines.Add('Anthropic error: ' + E.ClassName + ' - ' + E.Message);
end;

Back to Events