Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatbuildrctl crash on JSONDecodeError when server does not respond JSON #146

Closed
rezib opened this issue Sep 1, 2023 · 0 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@rezib
Copy link
Contributor

rezib commented Sep 1, 2023

fatbuildrctl crashes with JSONDecodeError when HTTP server does not respond with valid JSON:

$ fatbuildrctl --uri https://build.rackslab.io/devs build -a slurm-web -d bookworm --sources 3.0.0a1.dev1@. --watch
Generating artifact slurm-web source tarball version 3.0.0a1.dev23 using directory .
Traceback (most recent call last):
  File "/usr/bin/fatbuildrctl", line 33, in <module>
    sys.exit(load_entry_point('Fatbuildr==2.1.0.dev57', 'console_scripts', 'fatbuildrctl')())
  File "/usr/lib/python3/dist-packages/fatbuildr/cli/__init__.py", line 34, in run
    cls()
  File "/usr/lib/python3/dist-packages/fatbuildr/cli/fatbuildrctl.py", line 437, in __init__
    args.func(args)
  File "/usr/lib/python3/dist-packages/fatbuildr/cli/fatbuildrctl.py", line 1000, in _run_build
    self._submit_watch(
  File "/usr/lib/python3/dist-packages/fatbuildr/cli/fatbuildrctl.py", line 1068, in _submit_watch
    task_id = caller(*args)
  File "/usr/lib/python3/dist-packages/fatbuildr/protocols/http/client.py", line 38, in error_handler_wrapper
    return method(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/fatbuildr/protocols/http/client.py", line 182, in build
    return response.json()['task']
  File "/usr/lib/python3/dist-packages/requests/models.py", line 900, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python3/dist-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)

This case should be handled more nicely.

@rezib rezib added the bug Something isn't working label Sep 1, 2023
@rezib rezib added this to the v2.1.0 milestone Sep 1, 2023
@rezib rezib self-assigned this Sep 1, 2023
@rezib rezib closed this as completed in ec74b33 Jul 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant