From e49c1103b737ffd6053a297bc3891dd46cac35a3 Mon Sep 17 00:00:00 2001 From: Logan Cary Date: Fri, 16 Aug 2024 09:30:41 -0400 Subject: [PATCH] allow `ExcInfo.extra` to be `None` --- truenas_api_client/__init__.py | 4 ++-- truenas_api_client/jsonrpc.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/truenas_api_client/__init__.py b/truenas_api_client/__init__.py index c5090fd..447e7e1 100644 --- a/truenas_api_client/__init__.py +++ b/truenas_api_client/__init__.py @@ -320,7 +320,7 @@ def result(self) -> Any: raise ClientException('No job event was received.') if job['state'] != 'SUCCESS': if job['exc_info'] and job['exc_info']['type'] == 'VALIDATION': - raise ValidationErrors(job['exc_info']['extra']) + raise ValidationErrors(job['exc_info']['extra'] or []) raise ClientException( job['error'], trace={ @@ -674,7 +674,7 @@ def on_close(self, code: int, reason: str | None=None): job['exc_info'] = { 'type': 'Exception', 'repr': error, - 'extra': [], + 'extra': None, } event.set() diff --git a/truenas_api_client/jsonrpc.py b/truenas_api_client/jsonrpc.py index da01440..5cbe837 100644 --- a/truenas_api_client/jsonrpc.py +++ b/truenas_api_client/jsonrpc.py @@ -27,7 +27,7 @@ class ErrorExtra(NamedTuple): class ExcInfo(TypedDict): type: str - extra: list[ErrorExtra] + extra: list[ErrorExtra] | None repr: str