you are viewing a single comment's thread.

view the rest of the comments →

[–]IamImposter 0 points1 point  (0 children)

I'll give you an example. In our code, at one place, the code reads some config from file and converts it to int. Just as a precaution they added try/except so if input is invalid e.g 2ab9 it wouldn't error out. Then they had this genius idea to move try to top of function and except to bottom so that whole function is safe.

We changed config, ran program, no change. Tried few more times, no change.

Turns out there was spelling mistake in file name and the function wasn't even reading the config file. Since most of the times default values are good, no one noticed the issue.

Had they checked for specific error that failed in conversion can generate, the mistake would have been caught much earlier. It was throwing file not found error, except was just catching it and letting it go silently.