TsgcAIChat › Events › OnChatError
Fired when a chat request fails with an exception.
property OnChatError: TsgcAIChatErrorEvent;
// TsgcAIChatErrorEvent = procedure(Sender: TObject; const aError: string) of object
—
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.
procedure TForm1.oChatChatError(Sender: TObject; const aError: string);
begin
ShowMessage('Chat error: ' + aError);
end;