Skip to content
This repository has been archived by the owner on Mar 31, 2022. It is now read-only.

Stack trace on non-json responses #46

Open
KevinCLydon opened this issue Mar 15, 2022 · 0 comments
Open

Stack trace on non-json responses #46

KevinCLydon opened this issue Mar 15, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@KevinCLydon
Copy link
Member

Receiving a non-json response from a request seems to give a stack trace due to a difference in the JSONDecodeError we're accounting for and the one being raised by the requests library.

Example stack trace:

$ carrot_cli pipeline find
2022-03-15 11:38:24,176 carrot_cli.__main__                                                                                   INFO   Invoked by: /usr/local/bin/carrot_cli pipeline find
2022-03-15 11:38:24,176 carrot_cli.__main__                                                                                   INFO   Log level set to: INFO
Traceback (most recent call last):
 File “/usr/local/bin/carrot_cli”, line 8, in <module>
  sys.exit(main_entry())
 File “/usr/local/lib/python3.9/site-packages/click/core.py”, line 829, in __call__
  return self.main(*args, **kwargs)
 File “/usr/local/lib/python3.9/site-packages/click/core.py”, line 782, in main
  rv = self.invoke(ctx)
 File “/usr/local/lib/python3.9/site-packages/click/core.py”, line 1259, in invoke
  return _process_result(sub_ctx.command.invoke(sub_ctx))
 File “/usr/local/lib/python3.9/site-packages/click/core.py”, line 1259, in invoke
  return _process_result(sub_ctx.command.invoke(sub_ctx))
 File “/usr/local/lib/python3.9/site-packages/click/core.py”, line 1066, in invoke
  return ctx.invoke(self.callback, **ctx.params)
 File “/usr/local/lib/python3.9/site-packages/click/core.py”, line 610, in invoke
  return callback(*args, **kwargs)
 File “/usr/local/lib/python3.9/site-packages/carrot_cli/pipeline/command.py”, line 82, in find
  pipelines.find(
 File “/usr/local/lib/python3.9/site-packages/carrot_cli/rest/pipelines.py”, line 38, in find
  return request_handler.find(“pipelines”, params)
 File “/usr/local/lib/python3.9/site-packages/carrot_cli/rest/request_handler.py”, line 29, in find
  return send_request(“GET”, address, params=params)
 File “/usr/local/lib/python3.9/site-packages/carrot_cli/rest/request_handler.py”, line 210, in send_request
  json_body = response.json()
 File “/usr/local/lib/python3.9/site-packages/requests/models.py”, line 900, in json
  return complexjson.loads(self.text, **kwargs)
 File “/usr/local/lib/python3.9/site-packages/simplejson/__init__.py”, line 525, in loads
  return _default_decoder.decode(s)
 File “/usr/local/lib/python3.9/site-packages/simplejson/decoder.py”, line 370, in decode
  obj, end = self.raw_decode(s)
 File “/usr/local/lib/python3.9/site-packages/simplejson/decoder.py”, line 400, in raw_decode
  return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
@KevinCLydon KevinCLydon added the bug Something isn't working label Mar 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant