Can I ignore an exception only once?
Asked Answered
C

1

10

When an exception occurs the debugger gives me the following message:

enter image description here

I can choose to ignore the exception by checking ignore this exception type.
However doing this ignores this exception in all future projects, which is worse than useless because I don't want to ignore exceptions in every project; I just want to ignore them in this run.

Using the ToolsAPI, is there a way to:

A - ignore exceptions for this run only, or
B - ignore exceptions just for this project, or
C - restore the ignore exception settings when I restart Delphi?

If I can do A, B or C my problem is solved.

I know the ignore exception data is stored in:

HKEY_CURRENT_USER\Software\Embarcadero\BDS\17.0\Debugging\Embarcadero Debuggers\Language Exception Classes

My preferred option would be to use the ToolsAPI to fixup the messagebox and add a ignore this exception for this session only checkbox.
But if that's not available I'm fine with messing about with the registry.
If I do fall back to the registry, I would like to force Delphi to reload the settings so I don't have to restart the IDE.

For the record I'm using Seattle, but I'd prefer this to work from 2007 onwards.

I checked the ToolsAPI, but IOTAFileFilterWithCheckEncode looks unrelated and I think IOTABreakpoint80 only applies to breakpoints set by a user.

I don't have source yet, because I'm not sure what I want is possible using the ToolsAPI, and if it isn't I'll just fallback to using an external app that records the above registry key, starts Delphi and restores the registry key. I'm hoping there's a cleaner way though.

Clea answered 5/6, 2016 at 13:32 Comment(3)
Related: #9915059Clea
Does this help? It's not OTA-based, but it may give you an idea how to go about it. (I'm not sure how OTA works with breakpoints or whether it supports accessing advanced properties, but it might be a place to start.)Natheless
@KenWhite, I could use that to place two 'silent' breakpoints around any single exception and ignore just that one particular source of exception(s). That's actually a cool idea, but a bit more advanced than what I'm looking for right now.Clea
S
1

Unfortunately Exception ignoring settings are global IDE settings and not per project settings so whenever you are changing them that changes would affect all of your projects.

I wish Embarcadero would add this into project options so that we could have different ignore exception settings for different projects.

Any way after you check ignore this exception type and click either Continue or Break button the global IDE settings are changed and mentioned exception is added into Exception types to ignore list under
Options->Debugger Options->Embarcadero Debugger->language Exceptions

Exception types to ignore

In my case I added EDivByZero exception as an example.

Later on you can just check or uncheck the check box in front of certain exception to control whether Delphi IDE would ignore it or not.

Now is it possible to change these setting using ToolsAPI? That I don't know since I don't have any experience of working with ToolsAPI.

I hope I might have at least point you in the right direction.

Samarasamarang answered 6/6, 2016 at 11:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.