Skip to content

Improve error with non-existing workspace in debusine workspace-inheritance

I tried to lookup the workspace inheritance of a workspace and I run:

$ debusine --server freexian workspace-inheritance freexian/sandbox
Traceback (most recent call last):
  File "/usr/bin/debusine", line 8, in <module>
    sys.exit(entry_point())
             ~~~~~~~~~~~^^
  File "/usr/lib/python3/dist-packages/debusine/client/__main__.py", line 22, in entry_point
    main.execute()
    ~~~~~~~~~~~~^^
  File "/usr/lib/python3/dist-packages/debusine/client/cli.py", line 734, in execute
    self._workspace_inheritance(
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        debusine,
        ^^^^^^^^^
        self.args.workspace,
        ^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3/dist-packages/debusine/client/cli.py", line 1513, in _workspace_inheritance
    current = debusine.get_workspace_inheritance(workspace)
  File "/usr/lib/python3/dist-packages/debusine/client/debusine.py", line 889, in get_workspace_inheritance
    return self._debusine_http_client.get(
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
        f"/workspace/{workspace}/inheritance/",
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        expected_class=WorkspaceInheritanceChain,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/lib/python3/dist-packages/debusine/client/debusine_http_client.py", line 44, in get
    return self._api_request("GET", self._api_url + path, expected_class)
           ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/debusine/client/debusine_http_client.py", line 298, in _api_request
    raise exceptions.NotFoundError(f'Not found ({url})')
debusine.client.exceptions.NotFoundError: Not found (https://debusine.freexian.com/api/1.0/workspace/freexian/sandbox/inheritance/)

We should really show a much friendlier error message than this one for the common error of mistyping the workspace name.

I also wonder whether we should print a much clearer error message when user try to input a workspace name with a /, indicating that slash are forbidden in workspace names and that the scope is defined by the server configuration that you select (but this should apply to all --workspace parameters too).

/cc @enrico

Edited by Raphaël Hertzog
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information