Reputation: 313
Pydev 2.2 added a great functionality allowing us to break on exceptions.
My problem is that I'm getting tons of exceptions from the python libs before I even get to my code.
Is there a way to configure PyDev to only break on exceptions raised in my code?
To be specific: I want to break when the exception occurs - not when it's caught
Thanks in advance!
Upvotes: 3
Views: 1458
Reputation: 25372
[Edit]
Note that on newer PyDev versions, PyDev now supports this in the UI: enable the debug perspective and select PyDev > Manage Exception Breakpoints.
[End Edit]
There's nothing in the UI for that, but you can do the following:
In eclipse/plugins/org.python.pydev.debug/pysrc/pydevd_frame.py, edit the method handle_exception, and make its first lines something as:
def handle_exception(self, frame, event, arg):
if 'my_module' not in self._args[1]:
return
...
...
(the self._args[1] is the filename where the caught exception was found, so, you can use any heuristic there based on where the code you want to catch exceptions in is located).
Upvotes: 6