commit 125df26bf9d6b4cfbfb68770fa47f2055f29b8dc
Author: Stephen Finucane <email address hidden>
Date: Thu Jun 4 12:13:56 2020 +0100
Use 'Exception.__traceback__' for versioned notifications
The 'inspect.trace()' function is expected to be called within the
context of an exception handler. The 'from_exc_and_traceback' class
method of the 'nova.notification.objects.exception.ExceptionPayload'
class uses this to get information about a provided exception, however,
there are cases where this is called from outside of an exception
handler. In these cases, we see an 'IndexError' since we can't get the
last frame of a non-existent stacktrace. The solution to this is to
fallback to using the traceback embedded in the exception. This is a bit
lossy when decorators are involved but for all other cases this will
give us the same information. This also allows us to avoid passing a
traceback argument to the function since we have it to hand already.
Change-Id: I404ca316b1bf2a963106cd34e927934befbd9b12
Signed-off-by: Stephen Finucane <email address hidden>
Closes-Bug: #1881455
Reviewed: https:/ /review. opendev. org/733668 /git.openstack. org/cgit/ openstack/ nova/commit/ ?id=125df26bf9d 6b4cfbfb68770fa 47f2055f29b8dc
Committed: https:/
Submitter: Zuul
Branch: master
commit 125df26bf9d6b4c fbfb68770fa47f2 055f29b8dc
Author: Stephen Finucane <email address hidden>
Date: Thu Jun 4 12:13:56 2020 +0100
Use 'Exception. __traceback_ _' for versioned notifications
The 'inspect.trace()' function is expected to be called within the and_traceback' class ion.objects. exception. ExceptionPayloa d'
context of an exception handler. The 'from_exc_
method of the 'nova.notificat
class uses this to get information about a provided exception, however,
there are cases where this is called from outside of an exception
handler. In these cases, we see an 'IndexError' since we can't get the
last frame of a non-existent stacktrace. The solution to this is to
fallback to using the traceback embedded in the exception. This is a bit
lossy when decorators are involved but for all other cases this will
give us the same information. This also allows us to avoid passing a
traceback argument to the function since we have it to hand already.
Change-Id: I404ca316b1bf2a 963106cd34e9279 34befbd9b12
Signed-off-by: Stephen Finucane <email address hidden>
Closes-Bug: #1881455