Closed reckart closed 2 years ago
Describe the bug When trying to access the server with an invalid authentication token, a misleading error message is created.
To Reproduce
If possible, attach a minimal file that triggers the error.
Expected behavior A sensible message like "Invalid authentication ID" should be produced.
Error message
JSONDecodeError Traceback (most recent call last) /tmp/ipykernel_103878/1031767384.py in <module> 2 client = Client("MyServer").ensure_available() 3 project=client.get_project("test") ----> 4 project.list_document_collections() ~/.local/lib/python3.8/site-packages/averbis/core/_rest_client.py in list_document_collections(self) 1019 hierarchical: bool = True, 1020 ) -> Terminology: -> 1021 """ 1022 Create a new terminology. 1023 ~/.local/lib/python3.8/site-packages/averbis/core/_rest_client.py in _list_document_collections(self, project) 1562 self._delete_resources() 1563 -> 1564 @experimental_api 1565 def upload_resources( 1566 self, source: Union[IO, Path, str], path_in_zip: Union[Path, str] = "" ~/.local/lib/python3.8/site-packages/averbis/core/_rest_client.py in __request_with_json_response(self, method, endpoint, **kwargs) 1336 except requests.RequestException as e: 1337 self.__logger.info( -> 1338 "Server connection failed: waiting for server to become available..." 1339 ) 1340 pass ~/.local/lib/python3.8/site-packages/averbis/core/_rest_client.py in __handle_error(raw_response) 2392 return response["payload"] 2393 -> 2394 @experimental_api 2395 def _download_resources( 2396 self, target_zip_path: Union[Path, str], project_name=None, pipeline_name=None ~/.local/lib/python3.8/site-packages/requests/models.py in json(self, **kwargs) 908 # used. 909 pass --> 910 return complexjson.loads(self.text, **kwargs) 911 912 @property ~/.local/lib/python3.8/site-packages/simplejson/__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, use_decimal, **kw) 523 parse_constant is None and object_pairs_hook is None 524 and not use_decimal and not kw): --> 525 return _default_decoder.decode(s) 526 if cls is None: 527 cls = JSONDecoder ~/.local/lib/python3.8/site-packages/simplejson/decoder.py in decode(self, s, _w, _PY3) 368 if _PY3 and isinstance(s, bytes): 369 s = str(s, self.encoding) --> 370 obj, end = self.raw_decode(s) 371 end = _w(s, end).end() 372 if end != len(s): ~/.local/lib/python3.8/site-packages/simplejson/decoder.py in raw_decode(self, s, idx, _w, _PY3) 398 elif ord0 == 0xef and s[idx:idx + 3] == '\xef\xbb\xbf': 399 idx += 3 --> 400 return self.scan_once(s, idx=_w(s, idx).end()) JSONDecodeError: Expecting value: line 2 column 1 (char 2)
Please complete the following information:
I have tried this against the HD 6.6.0 and it gives me a 401 Server Error: 'Unauthorized' - looks good. Seem we don't have to do anything here.
401 Server Error: 'Unauthorized'
Describe the bug When trying to access the server with an invalid authentication token, a misleading error message is created.
To Reproduce
If possible, attach a minimal file that triggers the error.
Expected behavior A sensible message like "Invalid authentication ID" should be produced.
Error message
Please complete the following information: