lib: Fix silent assertitons

There are a couple of assert statements in the codebase which can
make jw-pkg fail without any detail whatsoever if --backtrace is not
specified, fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-04-25 07:45:14 +02:00
commit 3ac3aff997
Signed by: Jan Lindemann
GPG key ID: 3750640C9E25DD61
7 changed files with 19 additions and 12 deletions

View file

@ -26,8 +26,10 @@ class Distro(abc.ABC):
os_release_str: str|None=None,
default_pkg_filter: PackageFilter|None=None,
) -> None:
assert ec is not None
assert id is not None
if id is None:
raise ValueError(f'Tried to instaniate Distro without id')
if ec is None:
raise ValueError(f'Tried to instaniate Distro "{id}" without execution context')
self.__exec_context = ec
self.__id: str|None = None
self.__os_release_str: str|None = os_release_str