0001-Fix-problem-with-re-raise-exceptions-in-wrapped-functions.patch 875 B

1234567891011121314151617181920212223242526
  1. From 57c563f8b47a56feefc0a8bcbef05f4b54280549 Mon Sep 17 00:00:00 2001
  2. From: mmbutter <mario.butter@gmail.com>
  3. Date: Tue, 9 Jun 2020 11:50:41 -0500
  4. Subject: [PATCH] Fix problem with re-raise exceptions in wrapped functions.
  5. [Retrieved from:
  6. https://github.com/whilp/cli/commit/57c563f8b47a56feefc0a8bcbef05f4b54280549]
  7. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  8. ---
  9. lib/cli/app.py | 3 +++
  10. 1 file changed, 3 insertions(+)
  11. diff --git a/lib/cli/app.py b/lib/cli/app.py
  12. index 7b6db52..f487ab4 100644
  13. --- a/lib/cli/app.py
  14. +++ b/lib/cli/app.py
  15. @@ -240,6 +240,9 @@ def run(self):
  16. try:
  17. returned = self.main(*args)
  18. except Exception, e:
  19. + elif isinstance(e, self.reraise):
  20. + # raising the last exception preserves traceback
  21. + raise
  22. returned = e
  23. return self.post_run(returned)