4 Errors
This chapter covers
- The distinction between errors a system can recover from and those it cannot recover from
- Failing fast and failing loudly
- Different techniques for signaling errors and considerations for choosing which to use
The environment in which our code runs tends to be imperfect: users will provide invalid inputs, external systems will go down, and our code and other code around it will often contain some number of bugs. Given this, errors are inevitable; things can and will go wrong, and as a result we can’t write robust and reliable code without thinking carefully about error cases. When thinking about errors, it’s often useful to distinguish between errors from which a piece of software might want to recover and those ...
Get Good Code, Bad Code 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.