4 ms·
My coworker is a fan of: try: something() # that throws nonfatal errors frequently except: pass "it saves time in development" they say. Good luc
by kortex 7y ago
My coworker is a fan of:
try:
something() # that throws nonfatal errors frequently
except:
pass
"it saves time in development" they say. Good luck if something in that (non trivial) function call breaks.
Ugh.
Don't be like that.
If you don't know the precise error, heres the solution (in python):
except Exception as exc:
log("{}: {}".format(type(exc).__name__, exc))
Bingo, you now know what to catch. Catch that error, move your broad exception down (or remove if you can)
- mpfundstein 7y agoHow can his code pass code review?