3

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!

1 Answer 1

6

[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).

Sign up to request clarification or add additional context in comments.

1 Comment

Just what I was looking for. Thanks. I think it would make a useful addition to PyDev's UI

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.