ShowException (Delphi)
Description
In addition to displaying the exception message, which happens by default, the following code shuts down the application when an exception is not caught and handled. AppException should be declared a method of TForm1.
Code
procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.OnException := AppException;
end;
procedure TForm1.AppException(Sender: TObject; E: Exception);
begin
  Application.ShowException(E);
  Application.Terminate;
end; 
procedure TForm1.Button1Click(Sender: TObject);
begin
  raise EPasswordInvalid.Create('Incorrect password entered');
end;
Uses
- Vcl.Forms.TApplication.ShowException ( fr | de | ja )
- Vcl.Forms.TApplication.OnException ( fr | de | ja )
- Vcl.Forms.TApplication.Terminate ( fr | de | ja )
- System.SysUtils.Exception.Create ( fr | de | ja )