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

poor error message when interaction protocol fails #68

Open
rogpeppe opened this issue Jan 8, 2019 · 0 comments
Open

poor error message when interaction protocol fails #68

rogpeppe opened this issue Jan 8, 2019 · 0 comments
Labels

Comments

@rogpeppe
Copy link
Member

rogpeppe commented Jan 8, 2019

When an interaction fails, the bakery only prints the HTTP status code, not the actual returned error.
For example:

Traceback (most recent call last):
  File "/snap/canonical-rbac/18/bin/crbs-admin", line 11, in <module>
    load_entry_point('crbs==1.0.0', 'console_scripts', 'crbs-admin')()
  File "/snap/canonical-rbac/18/lib/python3.6/site-packages/crbs/cmd/_script.py", line 60, in __call__
    return self._actions[options.action](options)
  File "/snap/canonical-rbac/18/lib/python3.6/site-packages/crbs/cmd/_script.py", line 18, in __call__
    self.execute(options)
  File "/snap/canonical-rbac/18/lib/python3.6/site-packages/crbs/cmd/admin/_create_candid_agent.py", line 49, in execute
    parent=True)
  File "/snap/canonical-rbac/18/lib/python3.6/site-packages/crbs/candid.py", line 146, in create_user
    response = self._request('POST', 'v1/u', json=content)
  File "/snap/canonical-rbac/18/lib/python3.6/site-packages/crbs/candid.py", line 162, in _request
    resp = self._client.request(method, f'{self.url}/{path}', json=json)
  File "/snap/canonical-rbac/18/lib/python3.6/site-packages/macaroonbakery/httpbakery/_client.py", line 87, in request
    return requests.request(method=method, url=url, **kwargs)
  File "/snap/canonical-rbac/18/lib/python3.6/site-packages/requests/api.py", line 60, in request
    return session.request(method=method, url=url, **kwargs)
  File "/snap/canonical-rbac/18/lib/python3.6/site-packages/requests/sessions.py", line 533, in request
    resp = self.send(prep, **send_kwargs)
  File "/snap/canonical-rbac/18/lib/python3.6/site-packages/requests/sessions.py", line 653, in send
    r = dispatch_hook('response', hooks, r, **kwargs)
  File "/snap/canonical-rbac/18/lib/python3.6/site-packages/requests/hooks.py", line 31, in dispatch_hook
    _hook_data = hook(hook_data, **kwargs)
  File "/snap/canonical-rbac/18/lib/python3.6/site-packages/macaroonbakery/httpbakery/_client.py", line 292, in hook
    client.handle_error(error, req.url)
  File "/snap/canonical-rbac/18/lib/python3.6/site-packages/macaroonbakery/httpbakery/_client.py", line 104, in handle_error
    self.key,
  File "/snap/canonical-rbac/18/lib/python3.6/site-packages/macaroonbakery/bakery/_discharge.py", line 77, in discharge_all
    dm = get_discharge(cav.cav, cav.encrypted_caveat)
  File "/snap/canonical-rbac/18/lib/python3.6/site-packages/macaroonbakery/httpbakery/_client.py", line 156, in acquire_discharge
    'discharge failed with code {}'.format(resp.status_code))
macaroonbakery.httpbakery._error.DischargeError: third party refused dischargex: discharge failed with code 500

The code should treat the error response from a discharge endpoint as a regular error and print the message contained in it.

@rogpeppe rogpeppe added the bug label Jan 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant