In a Nutshell

To err is human; to repent, divine; to persist, devilish.

Benjamin Franklin

To err is human (but computers seem quite good at it, too). To handle these errors is divine.

Every line of code you write must be balanced by appropriate and thorough error checking and handling. A program without rigorous error handling will not be stable. One day an obscure error may occur, and the program will fall over as a result.

Handling errors and failure cases is hard work. It bogs programming down in the mundane details of the Real World. However, it’s absolutely essential. As much as 90 percent of the code you write handles exceptional circumstances. (Bentley 82) That’s a surprising statistic, so write code expecting to put far more effort into the ...

Get Code Craft now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.