OnException (Delphi)
Description
This example requires a TApplicationEvents and a TListBox on the form. Select the TApplicationEvents, double-click the OnException event and add the following code to the handler. Trigger this event by calling the Exception Create constructor.
Code
procedure TMainForm.ApplicationEventsException(Sender: TObject;
E: Exception);
begin
lbOther.Items.Add('Event OnException: ' + E.Message);
end;
procedure TMainForm.MenuExceptionClick(Sender: TObject);
resourcestring
sExceptionRaised = 'This is an exception';
begin
raise Exception.Create(sExceptionRaised);
end;