Error handling

From Code4Lib
Revision as of 17:49, 2 February 2009 by Jrochkind (Talk | contribs) (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...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.