{
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.
} 
procedure TForm1.FormCreate(Sender: TObject);
begin
  Application.OnException := AppException;
end;
procedure TForm1.AppException(Sender: TObject; E: Exception);
begin
  Application.ShowException(E);
  Application.Terminate;
end; 
