From 8f76a0dc1147cbe8a16e0d0835f42d2aea05d4be Mon Sep 17 00:00:00 2001 From: Joachim Jablon Date: Tue, 5 Dec 2023 17:58:28 +0100 Subject: [PATCH] Make subprocess errors more understandable --- coverage_comment/subprocess.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/coverage_comment/subprocess.py b/coverage_comment/subprocess.py index 94eafecd..f3a108cc 100644 --- a/coverage_comment/subprocess.py +++ b/coverage_comment/subprocess.py @@ -4,6 +4,8 @@ import subprocess from typing import Any +from coverage_comment import log + class SubProcessError(Exception): pass @@ -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: