4 ms·
> If an exception is unexpected, usually there won't be an exception handler for it That honestly depends on how the language and program are written, python i
by gabeio 4y ago
> If an exception is unexpected, usually there won't be an exception handler for it
That honestly depends on how the language and program are written, python is a great and horrible example of where you can handle any exception even ones that were just created by the program:
try:
crash_hard_here()
except: # by default (and unfortunately) will catch *everything*
pass # and this is one of the worst offenders inside an except, to just outright ignore the exception and continue as if nothing happened and to not even log it.
I can not tell you the amount of production code where I've seen catch all exceptions, and they are the lazy way to know something will not "crash" even though much worse things can happen now.
- blub 4y agoThis catch and ignore seems to be straight out of the (sadly not real) Visual Basic design patterns book :-)