From c63991fb4d0f02c27a10cc93b08a0d3901026755 Mon Sep 17 00:00:00 2001 From: "yan.haifeng" Date: Wed, 4 May 2016 15:38:42 +0800 Subject: [PATCH] Fix example issue example LOG.exception("An Exception occurred") in both usage.py, usage_helper.py and usage_i18n.py failed when use py34. fix it by raising exception before calling LOG.exception(). Change-Id: I2b6ea35fbf171232fea0cc54265f8be3dc61457f Closes-Bug: #1578071 --- doc/source/examples/usage.py | 5 ++++- doc/source/examples/usage_helper.py | 5 ++++- doc/source/examples/usage_i18n.py | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/source/examples/usage.py b/doc/source/examples/usage.py index e09ff036..1afcd36d 100644 --- a/doc/source/examples/usage.py +++ b/doc/source/examples/usage.py @@ -80,4 +80,7 @@ if __name__ == '__main__': LOG.debug("A debugging message") LOG.warning("A warning occurred") LOG.error("An error occurred") - LOG.exception("An Exception occurred") + try: + raise Exception("This is exceptional") + except Exception: + LOG.exception("An Exception occurred") diff --git a/doc/source/examples/usage_helper.py b/doc/source/examples/usage_helper.py index b8fb19a1..dcd76eb0 100644 --- a/doc/source/examples/usage_helper.py +++ b/doc/source/examples/usage_helper.py @@ -97,4 +97,7 @@ if __name__ == '__main__': LOG.debug("A debugging message") LOG.warning("A warning occurred") LOG.error("An error occurred") - LOG.exception("An Exception occurred") + try: + raise Exception("This is exceptional") + except Exception: + LOG.exception("An Exception occurred") diff --git a/doc/source/examples/usage_i18n.py b/doc/source/examples/usage_i18n.py index 820fffda..23c54302 100644 --- a/doc/source/examples/usage_i18n.py +++ b/doc/source/examples/usage_i18n.py @@ -81,4 +81,7 @@ if __name__ == '__main__': LOG.debug("A debugging message") # Debug messages are not translated LOG.warning(_LW("A warning occurred")) LOG.error(_LE("An error occurred")) - LOG.exception(_("An Exception occurred")) + try: + raise Exception(_("This is exceptional")) + except Exception: + LOG.exception(_("An Exception occurred"))