How to disable all exception raising in Delphi?

淺唱寂寞╮ 提交于 2019-12-05 17:56:08

If you just don't wont to show the exception window then go to:

Tools/Options/Debugger Options/Language Exceptions and disable CheckBox Notify on language exceptions. That is walid for Delphi 2010.

(I don't remember if it is the same CheckBox in Delphi 7).

EDIT: In some cases the exceptions are unavoidable, specially when we are working with unknown files from internet. So, I believe that your exceptions are handled properly under Indy, just switch-off Notify on language exceptions

You can customize Application.OnException event. But IMVHO...

  • Application.OnException suits best to log exceptions which you forgot to handle.
  • Application.OnException should be used to catch exceptions only when you desperately need performance (in this case you should anticipate broken execution paths).

And:

  • Access violations are fatal errors - you have to trace and get rid of all AV's.
  • You can't hide exception dialogs just by Application.OnException override - you should use try finally/except in right way.

Bypass the Application.OnException event. However I would NOT recommend hiding every exception, IMHO that is poor design.

@ GJ - Delphi 2007 has that check box. But again as was mentioned above, access violation ain't the kind of exceptions that one should ignore.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!