Skip to content

Commit

Permalink
Improve error message for SCM command failures
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
coordt committed Jun 25, 2024
1 parent 7527029 commit 8f72f86
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bumpversion/scm.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ def commit(cls, message: str, current_version: str, new_version: str, extra_args
if isinstance(exc, TypeError):
err_msg = f"Failed to run {cls._COMMIT_COMMAND}: {exc}"
else:
err_msg = f"Failed to run {exc.cmd}: return code {exc.returncode}, output: {exc.output}"
output = "\n".join([x for x in [exc.stdout, exc.stderr] if x])
err_msg = f"Failed to run {exc.cmd}: return code {exc.returncode}, output: {output}"
logger.exception(err_msg)
raise BumpVersionError(err_msg) from exc
finally:
Expand Down

0 comments on commit 8f72f86

Please sign in to comment.