Skip to content

Commit

Permalink
Cleanup: use logging.exception()
Browse files Browse the repository at this point in the history
  • Loading branch information
julen committed Oct 22, 2014
1 parent 0499c71 commit 316f825
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
17 changes: 8 additions & 9 deletions pootle/apps/pootle_app/management/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,8 @@ def do_translation_project(self, tp, pootle_path, **options):
logging.info(u"Running %s over %s", self.name, tp)
try:
process_stores = self.handle_translation_project(tp, **options)
except Exception as e:
logging.error(u"Failed to run %s over %s:\n%s",
self.name, tp, e)
except Exception:
logging.exception(u"Failed to run %s over %s", self.name, tp)
return

if not process_stores:
Expand All @@ -72,9 +71,9 @@ def do_translation_project(self, tp, pootle_path, **options):
logging.info(u"Running %s over %s's files", self.name, tp)
try:
self.handle_all_stores(tp, **options)
except Exception as e:
logging.error(u"Failed to run %s over %s's files\n%s",
self.name, tp, e)
except Exception:
logging.exception(u"Failed to run %s over %s's files",
self.name, tp)
return
elif hasattr(self, "handle_store"):
store_query = tp.stores.all()
Expand All @@ -88,9 +87,9 @@ def do_translation_project(self, tp, pootle_path, **options):
self.name, store.pootle_path)
try:
self.handle_store(store, **options)
except Exception as e:
logging.error(u"Failed to run %s over %s:\n%s",
self.name, store.pootle_path, e)
except Exception:
logging.exception(u"Failed to run %s over %s",
self.name, store.pootle_path)

def handle_noargs(self, **options):
# adjust debug level to the verbosity option
Expand Down
4 changes: 2 additions & 2 deletions pootle/apps/pootle_app/management/commands/refresh_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ def handle_all(self, **options):
prj.refresh_stats(include_children=True)

self.unregister_refresh_stats()
except Exception as e:
logging.error(u"Failed to run %s:\n%s", self.name, e)
except Exception:
logging.exception(u"Failed to run %s", self.name)
else:
super(Command, self).handle_all(**options)

Expand Down

0 comments on commit 316f825

Please sign in to comment.