fix or remove except Exception rule
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
hacking |
Fix Released
|
Medium
|
Unassigned |
Bug Description
From the original source:
"Never use catch-all except: statements, or catch Exception or StandardError, unless you are re-raising the exception or in the outermost block in your thread (and printing an error message). Python is very tolerant in this regard and except: will really catch everything including misspelled names, sys.exit() calls, Ctrl+C interrupts, unittest failures and all kinds of other exceptions that you simply don't want to catch."
I agree with the intent here - but I'm concerned that our implementation leaves out the "unless you are in the outermost block in your thread" - because I think that's a totally valid use case. Also, ours permits except Exception: in place of except: which I don't think was the intent. SO - I'd say that what we want in general would be:
Block use of except: or except Exception: or except StandardError: anywhere ... except:
Figure out a non-hacky way to allow expression of an except: in top loops.
Changed in hacking: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in hacking: | |
milestone: | none → 0.9.0 |
Changed in hacking: | |
status: | Fix Committed → Fix Released |
This check, H201, now supports noqa