Reputation: 360
The PyCharm debugger has the feature to set breakpoints at raised exceptions. However if an exception is handled inside a try except block it is not raised. How to deal with this if I want to debug within the try block? I could comment out the try except parts but this seems too cumbersome. Is there a better solution?
Upvotes: 4
Views: 1002
Reputation: 19432
In the breakpoints settings (Either the icon in the debug toolbar, or ctrl+shft+F8), you can set exception breakpoints.
The "Activation Policy" is usually set by default to "On termination". But since you handle the error, there is no termination. To activate the breakpoint immediately, even if the error is handled, you need to set the activation policy to "On raise":
Note: that warning sign which says: "This option may slow down the debugger"
Upvotes: 3