Try...except problem - cannot prevent the debug session from halting? lazarus / 12-Debugger ---------------------------------------------------------------------- Jeff_t · 2025-09-23 08:20 Im trying to use an XML file. I get a node, and want to get the value of some attributes. Some attributes are optional. If I ask for the value of an attribute that is not present in the file, it generates an exception and stops the running app in the IDE. I expected that by wrapping the call inside a try...except  , that the issue would be more or less ignored, and the app would run. However, even inside a try...except, the debugging app still stops and throws up a message. Is there some way to prevent that ? (In theory, the TDomNode should have a .HasAttribute method, but it doesnt seem to work for me.. ) ---------------------------------------------------------------------- Jeff_t · 2025-09-23 11:52 Later: I have realised that the exception is because I put 'getting the attribute node'  and 'getting the nodevalue' as one line. If the attribute doesn't exist, it returns a nil, which is reasonable. and asking for a nodevalue from a nil is obviously bad. So doing it in two steps avoids the exception. However, the bigger problem still stands: if an exception does occur, wrapping it in try...except doesnt seem to allow me to ignore it.. it just stops with a message, so is there a way to stop that? In a similar vein, if an exception occurs in an unexpected place, can I get the debugger to pause and say 'this is the place where a problem occurred'? ---------------------------------------------------------------------- Zoran · 2025-09-24 08:52 Quote from: Jeff_t on September 23, 2025, 01:52:28 pmHowever, the bigger problem still stands: if an exception does occur, wrapping it in try...except doesnt seem to allow me to ignore it.. it just stops with a message, so is there a way to stop that? The debugger stops on an exception. This does not happen outside of a debug session, does it? Try to run the program outside of the ide -- does it still happen? This is the default debugger behaviour, to always stop on an exception, as it might be useful during debugging. If you don't need it and it annoys you, it can be turned off -- see: https://wiki.lazarus.freepascal.org/IDE_Window:_Project_Options_- _Debugger_Language_Exceptions -- uncheck "Notify on exceptions". ---------------------------------------------------------------------- Martin_fr · 2025-10-12 10:52 Quote from: Zoran on September 24, 2025, 10:52:26 am -- see: https://wiki.lazarus.freepascal.org/IDE_Window:_Project_Options_- _Debugger_Language_Exceptions -- uncheck "Notify on exceptions". That was broken, except for the GDB backend. In 4.99 that now works for all backends. You can always check the "ignore this exception type" checkbox, when the notification comes. Then it wont show again (for that class / each class needs to be added once). This is for each project. But you can save project settings as default for new projects (checkbox in lower left corner)