3 ms·
How would that be any more helpful than just catching a generic exception and logging it and do_other_thing?
by scarface74 8y ago
How would that be any more helpful than just catching a generic exception and logging it and do_other_thing?
- teddyh 8y agoIf a low-level module has an unexpected ValueError or ZeroDivisionError, I don’t want that to be inadvertently caught and hidden by my except clause. In general, I want truly unexpected errors to propagate to the top level and generate a proper crash. Only in the case of code where I really need to do something if a specific operation fails, for whatever reason, do I use “except Exception:” or its even more catch-all variant, the bare “except:” clause. And even then, I very often just use it to log a message or send an e-mail, and re-raise the exception again afterwards.