Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable exception handling and let windows catch it?

I want to disable the exception catching by Delphi and let Windows catch it - making it produce a window like "AppName crashed. Debug , Send", add this to Application events, create a memory dump and so on.

By default, Delphi catches all the exception in TApplication.Run procedure... How can I avoid that without modifying Forms.pas?

like image 934
djsoft Avatar asked Aug 26 '12 17:08

djsoft


Video Answer


1 Answers

You could add an OnException handler that re-raised the exception:

class procedure TMainForm.OnException(Sender: TObject; E: Exception);
begin
  raise Exception(AcquireExceptionObject);
end;

initialization
  Application.OnException := TMainForm.OnException;

I'm not sure why you would want to do this at all though. It's more normal to use a tool like madExcept or EurekaLog to show an error dialog that yields much more helpful information than the system dialog.

like image 96
David Heffernan Avatar answered Oct 08 '22 21:10

David Heffernan