I'm writing an exception clause at the top level of a script, and I just want it to log whatever errors occur. Annoyingly, PyCharm complains if I just catch Exception
.
import logging
logging.basicConfig()
try:
raise RuntimeError('Bad stuff happened.')
except Exception: # <= causes warning: Too broad exception clause
logging.error('Failed.', exc_info=True)
Is there something wrong with this handler? If not, how can I tell PyCharm to shut up about it?