Ignoring Code Errors
"Take errors seriously and deal with them promptly" is the message that Pete Goodliffe emphasizes in his experience of ignoring the pain in his leg after tripping on the curb, which resulted in a worse injury. Similarly, he urges programmers not to overlook errors in their code, no matter how minor they seem, as they can lead to more significant problems in the future. Goodliffe suggests that programmers should always check for errors, handle them appropriately, and expose potentially erroneous conditions in their interfaces.
Goodliffe discusses various ways of reporting errors in code, including return codes, errno, and exceptions. He notes that error return codes are often ignored, and errno is hard to use, while exceptions cannot be overlooked. He highlights the risks of ignoring errors, such as brittle code, insecure code, and poor structure.
Goodliffe addresses common excuses for not handling errors, such as cluttering the code flow, extra work, and confidence that a function call will never return an error. He urges programmers to counter these excuses by keeping code clean and concise, making error handling a priority, and recognizing that even seemingly infallible functions can fail.
In summary, Goodliffe's message is clear: ignoring errors is lazy and can lead to significant problems in the future. Programmers should take errors seriously, check for them regularly, and handle them promptly to avoid complications down the road.#ErrorHandling