Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make subprocess errors more understandable #304

Merged
merged 1 commit into from
Dec 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading