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:
parent
120a6e4d34
commit
3ac3aff997
7 changed files with 19 additions and 12 deletions
|
|
@ -149,7 +149,7 @@ class ExecContext(Base):
|
|||
if interactive is None:
|
||||
interactive = sys.stdin.isatty()
|
||||
self.__cmd_input = None
|
||||
assert interactive in [ True, False ]
|
||||
assert interactive in [ True, False ], f'Invalid: interactive = {invalid}'
|
||||
self.__interactive = interactive
|
||||
|
||||
self.__cmd_input = cmd_input if not isinstance(cmd_input, InputMode) else None
|
||||
|
|
@ -285,7 +285,7 @@ class ExecContext(Base):
|
|||
|
||||
# Note that in the calls to the wrapped method, cmd_input == None can
|
||||
# be returned by CallContext and is very much allowed
|
||||
assert cmd_input is not None
|
||||
assert cmd_input is not None, 'Invalid: cmd_input is None'
|
||||
|
||||
ret = Result(None, None, 1)
|
||||
with self.CallContext(self, title=title, cmd=cmd, cmd_input=cmd_input, mod_env=mod_env, wd=wd,
|
||||
|
|
@ -379,7 +379,7 @@ class ExecContext(Base):
|
|||
|
||||
# Note that in the calls to the wrapped method, cmd_input == None can
|
||||
# be returned by CallContext and is very much allowed
|
||||
assert cmd_input is not None
|
||||
assert cmd_input is not None, 'Invalid: cmd_input is None'
|
||||
|
||||
ret = Result(None, None, 1)
|
||||
with self.CallContext(self, title=title, cmd=cmd, cmd_input=cmd_input,
|
||||
|
|
@ -578,7 +578,8 @@ class ExecContext(Base):
|
|||
_raise_stat_error(path, result.stderr, result.status)
|
||||
|
||||
async def _chown(self, path: str, owner: str|None, group: str|None) -> None:
|
||||
assert owner is not None or group is not None
|
||||
if owner is None and group is None:
|
||||
raise ValueError(f'Tried to chown("{path}") without owner and group')
|
||||
if group is None:
|
||||
ownership = owner
|
||||
elif owner is None:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue