How to disable all exceptions in Delphi?

Is there a way to disable all dialog boxes when an exception or error occurs (e.g. access violations, socket errors, timeouts, etc.)? They sometimes occur in my program, but these errors are by no means fatal and can be ignored, only the dialog boxes are disturbing. I am using Delphi 7.

+4
source share
4 answers

If you just don’t want to show the exception box, go to:

Tools / Options / Debugger Settings / Language Exceptions and Disable CheckBox Notify about language exceptions . This is not valid for Delphi 2010.

(I don’t remember if this is the same CheckBox in Delphi 7).

EDIT: In some cases, exceptions are inevitable, especially when we work with unknown files from the Internet. So, I believe your exceptions are handled properly under Indy, just turn off Notify me of language exceptions

+6
source

You can set up an Application.OnException event. But IMVHO ...

  • Application.OnException is best suited for exception logs that you forgot to handle.
  • Application.OnException should be used to throw exceptions only when you desperately need performance (in this case, you should expect interruption of the execution paths).

and

  • Access violations are fatal errors - you need to track and get rid of all AV files.
  • You cannot hide exception dialogs only by overriding Application.OnException - you should use try finally / except in the right direction.
+5
source

Bypassing the Application.OnException event. However, I would not recommend hiding every exception, IMHO, this is a poor design.

+2
source

@GJ - Delphi 2007 has this checkbox. But again, as mentioned above, violation of access rights is not the exception that should be ignored.

0
source

All Articles