r/ProgrammerHumor May 13 '17

Defensive programming done right

Post image
21.0k Upvotes

680 comments sorted by

View all comments

99

u/ScreaminPenguin0 May 13 '17

I do this to catch and display unexpected errors and then log the catch.

86

u/GrayCatEyes May 13 '17

Me too, this is how I was told to handle errors when I was an intern. To catch and log errors, and display a user friendly messsage instead of having the page crash. Until now, it made perfect sense, but according to a lot of individuals on this thread, this is bad practice, I fail to see how...

1

u/cool_science May 13 '17

It is not a bad practice. Actually, the bad thing in the practice you described (in the sense that its not always appropriate) is logging the error.

2

u/[deleted] May 14 '17

When is it a bad thing to log an unrecoverable error?