When an exception occurs the debugger gives me the following message:
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.
It is extremely easy to ignore exceptions, you simply surround your exception throwing code with a try and empty catch block. Exceptions are thrown when exceptional circumstances are experienced so by ignoring exceptions we are opening ourselves up for problems.
Sometimes, you may want to ignore an exception thrown by your Java program without stopping the program execution. To ignore an exception in Java, you need to add the try... catch block to the code that can throw an exception, but you don't need to write anything inside the catch block.
Let's say you want to ignore NameError, then you can just give continue or pass . Alternatively, you can also raise an exception. So you can use a combination of all this to get you what you want.
No, it raises a compiler error. Being a checked exception, you must either catch it or propagate it by declaring your method as potentially throwing it.
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 underOptions->Debugger Options->Embarcadero Debugger->language Exceptions
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With