Exception handling could be improved in a number of places
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Undecided
|
Stanislaw Pitucha |
Bug Description
A number of places in the code destroy part of the stacktrace by using the following pattern:
except SomeType, e:
....
raise e
Some of them modify the exception attributes - this is not needed either. Modifications and another "raise" work just fine.
Another issue is with stacked exception handling - the following pattern will always throw Exception('bad'), rather than what's in e1. This can be fixed by moving cleanup to a different function.
try:
f()
except Exception, e1:
try:
raise Exception('bad')
except Exception, e2:
pass
raise
Those patterns may be nice candidates to check in hacking.py in the future.
description: | updated |
Changed in nova: | |
assignee: | nobody → Stanislaw Pitucha (stanislaw-pitucha) |
status: | New → In Progress |
Changed in nova: | |
milestone: | none → grizzly-1 |
status: | Fix Committed → Fix Released |
Changed in nova: | |
milestone: | grizzly-1 → 2013.1 |
Reviewed: https:/ /review. openstack. org/13345 github. com/openstack/ nova/commit/ 4c09d809c9bd37e eb55f64ec01f8a0 b900f9a3bf
Committed: http://
Submitter: Jenkins
Branch: master
commit 4c09d809c9bd37e eb55f64ec01f8a0 b900f9a3bf
Author: Stanislaw Pitucha <email address hidden>
Date: Thu Sep 20 10:23:45 2012 +0100
Cleanup exception handling
Make sure stack traces are not cut short. Make sure there's only one
exception handler per function (otherwise new exception covers the old one).
Fixes bug 1053421
Change-Id: Id1ff84a5ba3eae ef6385b311773bd e784672e1f9