Skip to content

Commit 8f72f86

Browse files
committed
Improve error message for SCM command failures
The error message for failures in the SCM command execution has been enhanced. Now it displays not only the command's return code but also the standard output and error, improving the debugging process.
1 parent 7527029 commit 8f72f86

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bumpversion/scm.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def commit(cls, message: str, current_version: str, new_version: str, extra_args
7676
if isinstance(exc, TypeError):
7777
err_msg = f"Failed to run {cls._COMMIT_COMMAND}: {exc}"
7878
else:
79-
err_msg = f"Failed to run {exc.cmd}: return code {exc.returncode}, output: {exc.output}"
79+
output = "\n".join([x for x in [exc.stdout, exc.stderr] if x])
80+
err_msg = f"Failed to run {exc.cmd}: return code {exc.returncode}, output: {output}"
8081
logger.exception(err_msg)
8182
raise BumpVersionError(err_msg) from exc
8283
finally:

0 commit comments

Comments
 (0)