Chapter 26. Donât Ignore That Error!
I was walking down the street one evening to meet some friends in a bar. We hadnât shared a beer in some time, and I was looking forward to seeing them again. In my haste, I wasnât looking where I was going. I tripped over the edge of a curb and ended up flat on my face. Well, it serves me right for not paying attention, I guess.
It hurt my leg, but I was in a hurry to meet my friends. So, I pulled myself up and carried on. As I walked farther, the pain was getting worse. Although Iâd initially dismissed it as shock, I rapidly realized there was something wrong.
But I hurried on to the bar regardless. I was in agony by the time I arrived. I didnât have a great night out, because I was terribly distracted. In the morning, I went to the doctor and found out Iâd fractured my shin bone. Had I stopped when I felt the pain, I wouldâve prevented a lot of extra damage that I caused by walking on it. Probably the worst morning after of my life.
TOO MANY PROGRAMMERS write code like my disastrous night out.
Error, what error? It wonât be serious. Honestly. I can ignore it. This is not a winning strategy for solid code. In fact, itâs just plain laziness. (The wrong sort.) No matter how unlikely you think an error is in your code, you should always check for it, and always handle it. Every time. Youâre not saving time if you ...
Get 97 Things Every Programmer Should Know 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.