diff --git a/snapcraft/cli.py b/snapcraft/cli.py index 829c76ec68..5be59d7695 100644 --- a/snapcraft/cli.py +++ b/snapcraft/cli.py @@ -301,7 +301,12 @@ def run(): # noqa: C901 (complex-structure) emit.error(craft_cli.errors.CraftError(f"linter error: {err}")) retcode = err.exit_code except RemoteBuildError as err: - emit.error(craft_cli.errors.CraftError(f"remote-build error: {err}")) + emit.error( + craft_cli.errors.CraftError( + message=f"remote-build error: {err}", + docs_url="https://snapcraft.io/docs/remote-build", + ) + ) retcode = 1 except errors.SnapcraftError as err: _emit_error(err) diff --git a/snapcraft/remote/errors.py b/snapcraft/remote/errors.py index 7d8ca44150..27b88c0e7c 100644 --- a/snapcraft/remote/errors.py +++ b/snapcraft/remote/errors.py @@ -107,7 +107,6 @@ def __init__(self) -> None: class RemoteBuildFailedError(RemoteBuildError): """Remote build failed. - :param brief: Brief description of error. :param details: Detailed information. """ @@ -120,7 +119,6 @@ def __init__(self, details: str) -> None: class RemoteBuildInvalidGitRepoError(RemoteBuildError): """The Git repository is invalid for remote build. - :param brief: Brief description of error. :param details: Detailed information. """ diff --git a/snapcraft/remote/git.py b/snapcraft/remote/git.py index afc5cd5167..f6ae785662 100644 --- a/snapcraft/remote/git.py +++ b/snapcraft/remote/git.py @@ -103,12 +103,14 @@ def check_git_repo_for_remote_build(path: Path) -> None: if git_type == GitType.INVALID: raise RemoteBuildInvalidGitRepoError( - f"Could not find a git repository in {str(path)!r}" + f"Could not find a git repository in {str(path.absolute())!r}. " + "The project must be in the top-level of a git repository." ) if git_type == GitType.SHALLOW: raise RemoteBuildInvalidGitRepoError( - "Remote build for shallow cloned git repos are no longer supported" + "Remote builds are not supported for projects in shallowly cloned " + "git repositories." ) diff --git a/tests/unit/commands/test_remote.py b/tests/unit/commands/test_remote.py index 10167887d0..ac9232562b 100644 --- a/tests/unit/commands/test_remote.py +++ b/tests/unit/commands/test_remote.py @@ -621,7 +621,10 @@ def test_run_in_shallow_repo_unsupported(capsys, new_dir): assert ret != 0 _, err = capsys.readouterr() - assert "Remote build for shallow cloned git repos are no longer supported" in err + assert ( + "Remote builds are not supported for projects in shallowly cloned " + "git repositories." + ) in err ###################### diff --git a/tests/unit/remote/test_git.py b/tests/unit/remote/test_git.py index 9a50a68ae0..4993a1c681 100644 --- a/tests/unit/remote/test_git.py +++ b/tests/unit/remote/test_git.py @@ -538,7 +538,11 @@ def test_push_url_push_error(new_dir): def test_check_git_repo_for_remote_build_invalid(new_dir): """Check if directory is an invalid repo.""" with pytest.raises( - RemoteBuildInvalidGitRepoError, match="Could not find a git repository in" + RemoteBuildInvalidGitRepoError, + match=( + f"Could not find a git repository in {str(new_dir.absolute())!r}. " + "The project must be in the top-level of a git repository." + ), ): check_git_repo_for_remote_build(new_dir) @@ -584,6 +588,9 @@ def test_check_git_repo_for_remote_build_shallow(new_dir): with pytest.raises( RemoteBuildInvalidGitRepoError, - match="Remote build for shallow cloned git repos are no longer supported", + match=( + "Remote builds are not supported for projects in shallowly cloned " + "git repositories." + ), ): check_git_repo_for_remote_build(git_shallow_path)