Skip to content

Commit

Permalink
remove command from generic error
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Izquierdo committed Nov 2, 2023
1 parent 6f461b6 commit 7f3870f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
5 changes: 1 addition & 4 deletions src/aap_eda/services/project/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,7 @@ def __call__(
if "could not read Username" in e.stderr:
raise GitAuthenticationError("Credentials not provided")
# generic error
usr_msg = (
f"Command git failed with return code {e.returncode}. "
f"Cmd: {e.cmd} "
)
usr_msg = f"Command git failed with return code {e.returncode}. "
if e.stderr:
usr_msg += f"Error: {e.stderr}"
raise GitError(usr_msg) from e
6 changes: 3 additions & 3 deletions tests/unit/test_git.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ def raise_error(cmd, **kwargs):
raise subprocess.CalledProcessError(
128,
cmd,
stderr="fatal: Unknown error",
stderr="fatal: Unable to access "
"'https://me:[email protected]/repo.git'",
)

subprocess_run_mock.side_effect = raise_error
Expand Down Expand Up @@ -222,8 +223,7 @@ def raise_error(cmd, **_kwargs):

executor = GitExecutor()
message = re.escape(
f"Command git failed with return code 128. "
f"""Cmd: ['{shutil.which("git")}', 'status'] """
"Command git failed with return code 128. "
"Error: fatal: not a git repository",
)
with pytest.raises(GitError, match=message):
Expand Down

0 comments on commit 7f3870f

Please sign in to comment.