← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1281453] [NEW] Replace exception "re-raises" with excutils.save_and_reraise_exception()

 

Public bug reported:

There are quite a few places in the Glance code where exceptions are re-
raised:

  try:
     some_operation()
  except FooException as e:
    do_something1()
    raise
  except BarException as e:
    do_something2()
    raise

These places should use the excutils.save_and_reraise_exception class
because in some cases the exception context can be cleared, resulting in
None being attempted to be re-raised after an exception handler is run
(see excutils.save_and_reraise_exception for more).

  try:
     some_operation()
  except FooException as e:
      with excutils.save_and_reraise_exception() as ctxt:
          do_something1()
  except BarException as e:
      with excutils.save_and_reraise_exception() as ctxt:
          do_something2()

** Affects: glance
     Importance: Undecided
         Status: New


** Tags: low-hanging-fruit

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1281453

Title:
  Replace exception "re-raises" with
  excutils.save_and_reraise_exception()

Status in OpenStack Image Registry and Delivery Service (Glance):
  New

Bug description:
  There are quite a few places in the Glance code where exceptions are
  re-raised:

    try:
       some_operation()
    except FooException as e:
      do_something1()
      raise
    except BarException as e:
      do_something2()
      raise

  These places should use the excutils.save_and_reraise_exception class
  because in some cases the exception context can be cleared, resulting
  in None being attempted to be re-raised after an exception handler is
  run (see excutils.save_and_reraise_exception for more).

    try:
       some_operation()
    except FooException as e:
        with excutils.save_and_reraise_exception() as ctxt:
            do_something1()
    except BarException as e:
        with excutils.save_and_reraise_exception() as ctxt:
            do_something2()

To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1281453/+subscriptions


Follow ups

References