Skip to content

Improve error message when the inheritance chain does not validate

Try debusine workspace-inheritance sandbox --edit and provide that value:

chain:
- base

You will get a stack trace:

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 1528, in _workspace_inheritance
    new = WorkspaceInheritanceChain(**editor.value)
  File "/usr/lib/python3/dist-packages/pydantic/v1/main.py", line 347, in __init__
    raise validation_error
pydantic.v1.error_wrappers.ValidationError: 1 validation error for WorkspaceInheritanceChain
chain -> 0
  value is not a valid dict (type=type_error.dict)

We should simply print a validation error and not the stack trace. And maybe offer to re-edit the previous file?

Not also that the validation is relatively lax in the sense that it allows arbitrary keys.

Thus it will happily accept this (typo in "scope") and might select a workspace in the wrong scope due to this.

- scoppe: freexian
  workspace: base
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information