TsgcAIChat › Events › OnChatError

OnChatError Event

Fired when a chat request fails with an exception.

Syntax

property OnChatError: TsgcAIChatErrorEvent;
// TsgcAIChatErrorEvent = procedure(Sender: TObject; const aError: string) of object

Default Value

—

Remarks

Raised by Chat or ChatStream when the underlying provider call throws an exception (network error, invalid API key, malformed response, HTTP status error, and so on). aError carries the exception message. The failed method returns an empty string so handlers can show the error to the user or retry.

Example

procedure TForm1.oChatChatError(Sender: TObject; const aError: string);
begin
  ShowMessage('Chat error: ' + aError);
end;

Back to Events