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
|
|
@ -38,7 +38,8 @@ class FileContext(abc.ABC):
|
|||
self.__in_pipe = in_pipe
|
||||
self.__out_pipe = out_pipe
|
||||
self.__open_count = 0
|
||||
assert verbose_default is not None
|
||||
if not verbose_default in [True, False]:
|
||||
raise ValueError(f'Tried to instantiate FileContext with verbose_default = "{verbose_default}"')
|
||||
|
||||
async def __aenter__(self):
|
||||
await self.open()
|
||||
|
|
@ -87,7 +88,7 @@ class FileContext(abc.ABC):
|
|||
if self.__open_count == 1:
|
||||
await self._close()
|
||||
self.__open_count -= 1
|
||||
assert self.__open_count >= 0
|
||||
assert self.__open_count >= 0, f'Closed file context "{self.__uri}" more often than opened'
|
||||
|
||||
@classmethod
|
||||
def schema_from_uri(cls, uri: str) -> str:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue