Make raise/re-raise of exceptions in the code consistent
Re-raising exceptions across the code is somewhat skewed. At some places an
exception is handled and re-raised, at other places a plain raise statement is used and the
correct exception context may not be clear from the code.
Such statements should be identified and refactored to use the right contextual exception
object during a re-raise and supplement with a LOG message if needed.
Example from current trunk:
1.
except Exception:
try:
except Exception:
if ignore_
https:/
2. except OSError as e:
if e.errno == errno.ENOENT:
return
else:
raise # will be clearer if the caught object 'e' is passed as an expression here
https:/
Blueprint information
- Status:
- Complete
- Approver:
- None
- Priority:
- Undefined
- Drafter:
- Rohit Karajgi
- Direction:
- Needs approval
- Assignee:
- None
- Definition:
- Obsolete
- Series goal:
- None
- Implementation:
- Unknown
- Milestone target:
- None
- Started by
- Completed by
- Russell Bryant
Related branches
Sprints
Whiteboard
Suggesting that we do "raise e" instead of just "raise" changes what's happening. That's not what we want in these cases. --russellb