Difference between revisions of "Error handling"

From Code4Lib
Jump to: navigation, search
(New page: =General rule: provide a sane, hierarchical set of error classes and hooks to catch them as necessary= ==Specific rule: THROW SOME DARN ERRORS!!!!== Don’t be an idiot. Things will fail...)
 
(No difference)

Latest revision as of 17:49, 2 February 2009

General rule: provide a sane, hierarchical set of error classes and hooks to catch them as necessary

Specific rule: THROW SOME DARN ERRORS!!!!

Don’t be an idiot. Things will fail. In the absense of Design by Contract or somesuch, errors will happen. Throw them. Catch them. But at least throw them, instead of letting your code die six hundred lines later with a “Cannot cast null value to string” when you finally get around to trying to print something out.