crash on HTTP 401 error
- Dominant language
- Python
- Stars
- 1
- Forks
- 8
- PR merge metrics
- No merged PRs in 30d
Description
`chacractl binary create ` prints a stack trace if I have the wrong key in my `~/.chacractl`:
```
Traceback (most recent call last):
File "venv/bin/chacractl", line 6, in
main.ChacraCtl()
File "venv/local/lib/python2.7/site-packages/chacractl/main.py", line 37, in __init__
self.main(argv)
File "venv/local/lib/python2.7/site-packages/chacractl/decorators.py", line 68, in newfunc
return f(*a, **kw)
File "venv/local/lib/python2.7/site-packages/chacractl/main.py", line 80, in main
parser.dispatch()
File "venv/local/lib/python2.7/site-packages/tambo/dispatcher.py", line 21, in dispatch
return instance.main()
File "venv/local/lib/python2.7/site-packages/chacractl/api/binaries.py", line 123, in main
self.post(url, filename)
File "venv/local/lib/python2.7/site-packages/chacractl/api/binaries.py", line 80, in post
response.raise_for_status()
File "venv/local/lib/python2.7/site-packages/requests/models.py", line 837, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://chacra.example.com/binaries/myproject/myref/ubuntu/trusty/source/
```
It's probably better to catch the `HTTPError` and print an explanation to the user about what could have gone wrong.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start in chacractl/api/binaries.py, especially post() where response.raise_for_status() produces the traceback. Reproduce the issue with chacractl binary create using an incorrect key in ~/.chacractl. Done means the command explains the HTTP 401 authentication failure to the user without printing a stack trace.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100