Like This Site? 
 
RSS Feed Follow Us 

on Twitter! Be Our Fan!

Rules of Thumb For Good Exception Management

Share this post!
 Vote this!

  • Exceptions are exceptional and should be treated as such. If something exceptional, unusual, or generally "not supposed to ordinarily happen" then an exception is a reasonable thing to do.
    • You shouldn't throw exceptions for things that happen all the time. Then they'd be "ordinaries".
  • If your functions are named well, using verbs (actions) and nouns (stuff to take action on) then throw an exception if your method can't do what it says it can.
    • For example, SaveBook(). If it can't save the book - it can't do what it promised - then throw an exception. That might be for a number of reasons. 
More... 

0 comments:

Post a Comment