Fix error handling
This commit is contained in:
parent
4fe89e95fa
commit
d4ab82c07e
1 changed files with 2 additions and 2 deletions
|
@ -45,9 +45,9 @@ class PipedClient:
|
||||||
- `**kwargs` - Additional keyword arguments to pass to `requests.Session.get`
|
- `**kwargs` - Additional keyword arguments to pass to `requests.Session.get`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
json: dict = self.session.get(f"{self.base_api_url}{uri}", **kwargs).json()
|
json: t.Union[dict, list] = self.session.get(f"{self.base_api_url}{uri}", **kwargs).json()
|
||||||
|
|
||||||
if json.get('error', None) is not None:
|
if isinstance(json, dict) and json.get('error', None) is not None:
|
||||||
raise APIError(f"Error: {json['error']}")
|
raise APIError(f"Error: {json['error']}")
|
||||||
|
|
||||||
if as_model is not None:
|
if as_model is not None:
|
||||||
|
|
Loading…
Reference in a new issue