Tip 5 | Fail Gracefully |
[White Belt] Writing code that fails well is just as important as writing code that works well. |
What happens when code fails? It’s going to. Even if you wrote your part perfectly, there are all kinds of conditions that could cause the overall system to fail:
-
A rogue mail daemon on computer, busy sending offers of great wealth from some foreign country, consumes all the RAM and swap. Your next call to malloc() returns ETOOMUCHSPAM.
-
Java Update 134,001 fills up the system’s hard drive. You call write(), and the system returns ESWITCHTODECAF.
-
You try to pull data off a tape, but the tape robot is on a ship at sea, rolling waves ...
Get New Programmer's Survival Manual 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.