Home > Enterprise >  Is there a way to turn off Exception Notification in Delphi while unit testing, on a particular proj
Is there a way to turn off Exception Notification in Delphi while unit testing, on a particular proj

Time:06-16

I am using Delphi 11 with the DUnitx unit testing. I know that I can turn off "Language Exceptions" in Tools/Options. But this turns it off for all projects.

Is there a way to turn them off for "unit testing", or "per project".

CodePudding user response:

The only way I know of to accomplish this, in all Delphi versions, is by using breakpoints.

Put a breakpoint at the point in the code where you want to disable the debugger's exception handling. Right-click on the breakpoint to go into its properties. In the "Advanced" options, turn off the Break option and turn on the Ignore subsequent exceptions option.

Place another breakpoint at the point in the code where you want to re-enable the debugger's exception handling. In the properties, turn off the Break option and turn on the Handle subsequent exceptions option.

Now run the code, and you can debug as needed, except for the code you masked off.

CodePudding user response:

GExperts has got an expert that can filter specific exceptions, not just by exception type but also depending on the message. And it's project specific. I'm not sure how well this works with Delphi 11 though.

It also has a side effect: The IDE gets the focus for each of the exceptions and will then switch back to the program. This makes the computer nearly unusable if there are many exceptions.

  • Related