Skip to content

Commit

Permalink
Make subprocess errors more understandable
Browse files Browse the repository at this point in the history
  • Loading branch information
ewjoachim committed Dec 5, 2023
1 parent 88951c9 commit 8f76a0d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion coverage_comment/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import subprocess
from typing import Any

from coverage_comment import log


class SubProcessError(Exception):
pass
Expand All @@ -24,7 +26,8 @@ def run(*args, path: pathlib.Path, **kwargs) -> str:
**kwargs,
).stdout
except subprocess.CalledProcessError as exc:
raise SubProcessError("\n".join([exc.stdout, exc.stderr])) from exc
log.debug(f"Command failed: {args=} {path=} {kwargs=} {exc.stderr=}")
raise SubProcessError("\n".join([exc.stderr, exc.stdout])) from exc


class Git:
Expand Down

0 comments on commit 8f76a0d

Please sign in to comment.