Problem Statement
Why should you avoid a bare 'except:' in production code?
Explanation
A bare except can swallow control flow exceptions such as SystemExit and KeyboardInterrupt. This prevents graceful shutdowns and can make debugging hard.
Prefer catching specific exception classes. If you must catch all, catch Exception explicitly and re-raise unknown cases.
Code Solution
SolutionRead Only
try:
run()
except Exception as e:
log(e)
raise