diff options
author | Sergey Vilgelm <svilgelm@mirantis.com> | 2013-06-25 14:42:15 +0400 |
---|---|---|
committer | Sergey Vilgelm <svilgelm@mirantis.com> | 2013-06-25 14:55:09 +0400 |
commit | 31325752e1d202c95f65b8af0e656b283043f1cd (patch) | |
tree | 194bf8abe8537cdf589d5b4841361714e2a49907 /HACKING.rst | |
parent | bc10b7aeada4ea66e85e10b94b5c219e3c8d2e77 (diff) | |
download | oslo-31325752e1d202c95f65b8af0e656b283043f1cd.tar.gz oslo-31325752e1d202c95f65b8af0e656b283043f1cd.tar.xz oslo-31325752e1d202c95f65b8af0e656b283043f1cd.zip |
Do not raise NEW exceptions
Raising NEW exception is bad practice, because we lose TraceBack.
So all places like:
except SomeException as e:
raise e
should be replaced by
except SomeException:
raise
If we are doing some other actions before reraising we should
store information about exception then do all actions and then
reraise it. This is caused by eventlet bug. It lost information
about exception if it switch threads.
fixes bug 1191730
Change-Id: I7bce659591c4c3e4bc41e12d7d8390128c30e2e4
Diffstat (limited to 'HACKING.rst')
-rw-r--r-- | HACKING.rst | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/HACKING.rst b/HACKING.rst index 3cea316..846c1b1 100644 --- a/HACKING.rst +++ b/HACKING.rst @@ -46,6 +46,16 @@ General pass +- Use 'raise' instead of 'raise e' to preserve original traceback or exception being reraised:: + + except Exception as e: + ... + raise e # BAD + + except Exception: + ... + raise # OKAY + TODO vs FIXME ------------- |