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
This commit is contained in:
yan.haifeng 2016-05-04 15:38:42 +08:00
parent 12f03d4cf6
commit c63991fb4d
3 changed files with 12 additions and 3 deletions

View File

@ -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")

View File

@ -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")

View File

@ -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"))