Skip to content

Commit

Permalink
Merge pull request #35 from Tecnativa/log-error-context
Browse files Browse the repository at this point in the history
Log error context when a subprocess fails
  • Loading branch information
sbidoul committed Oct 1, 2019
2 parents 64dac23 + 418b89a commit dfdb3db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,12 @@ To work around API limitation, you must first generate a
Changes
=======

1.7.1 (September 30, 2019)
--------------------------

* If an error happens, log in which repo it happens. Helpful when running
in parallel.

1.7.0 (August 14, 2019)
-----------------------

Expand Down
6 changes: 5 additions & 1 deletion git_aggregator/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,11 @@ def log_call(self, cmd, callwith=subprocess.check_call,
:param meth: the calling method to use.
"""
logger.log(log_level, "%s> call %r", self.cwd, cmd)
ret = callwith(cmd, **kw)
try:
ret = callwith(cmd, **kw)
except Exception:
logger.error("%s> error calling %r", self.cwd, cmd)
raise
if callwith == subprocess.check_output:
ret = console_to_str(ret)
return ret
Expand Down

0 comments on commit dfdb3db

Please sign in to comment.