What is the correct fix?
try:
run()
except Exception:
log('general')
except ValueError:
log('value')
- Put
except ValueErrorbefore Exception - Put
except ValueErrorafter the finally - Merge them into one
exceptstatement - Change
ExceptiontoBaseException
The first matching handler wins, so the broad one makes the specific one unreachable.
Play Problem Solving ▸