From f8d2f8689a31a7e81cdf06a4df45408a1a056595 Mon Sep 17 00:00:00 2001 From: Dan Prince Date: Tue, 18 Dec 2012 10:00:30 -0500 Subject: Raise old exception instance instead of new one. Updates the Nova conductor API's ExceptionHelper class so that it raises the previous exception instance instead of constructing a new exception class based on the old one's message. The motivation for this change is to enable testing of NovaException message formatting. Previously this function would always construct a new NovaException which had the incorrect (none) kwargs specified to properly format the message. The exception would get thrown... but it would cause extra LOG.error messages to appear in the log file due to the formatting errors. This commit works around the issue by raising the previous Exception directly. From 'pydoc raise': If the first object is an instance, the type of the exception is the class of the instance, the instance itself is the value, and the second object must be ``None``. Change-Id: I1dddc9e1e7e3d5f970baa9a34b709c943820295e --- nova/conductor/api.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nova/conductor/api.py b/nova/conductor/api.py index 4c2f031e6..b0ac45935 100644 --- a/nova/conductor/api.py +++ b/nova/conductor/api.py @@ -55,7 +55,7 @@ class ExceptionHelper(object): try: return func(*args, **kwargs) except rpc_common.ClientException, e: - raise e._exc_info + raise (e._exc_info[1], None, e._exc_info[2]) return wrapper -- cgit