Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. It's best to raise your exceptions at the point in the code where errors are going to occur.
  2.  
  3. When you have deeply nested code modules, then don't try to handle exceptions in-between, just raise the exception (instrument there too) and then let a _top level_ handler catch generalized exceptions to do its own instrumentation (if necessary).
  4.  
  5. This means it's a good idea for the top level handler to catch a generalized parent exception class type, and have your internal code raise subclass exceptions from that parent class.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement