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

bravado should be able to parse errors as json #156

Open
bpicolo opened this issue Jul 7, 2015 · 2 comments
Open

bravado should be able to parse errors as json #156

bpicolo opened this issue Jul 7, 2015 · 2 comments

Comments

@bpicolo
Copy link
Contributor

bpicolo commented Jul 7, 2015

Along with the idea of uniform exceptions, we definitely expect errors to come back with JSON responses in, well, most all occasions in our own apis.

Bravado should be able to parse exception messages that are json. Otherwise taking any action on them is virtually impossible.

Here's an example from (swaggerpy):

(Pdb) e
HTTPError(u'403 Client Error: Forbidden : {\n "error": {\n "code": "FLAGGING_FORBIDDEN", \n "description": "You can't flag this."\n }\n}',)
(Pdb) e.message
u'403 Client Error: Forbidden : {\n "error": {\n "code": "FLAGGING_FORBIDDEN", \n "description": "You can't flag this."\n }\n}'
(Pdb) e.request
(Pdb) e.response

Probably doesn't help that error request/response are empty.
I can't even json.loads it myself because we stuff the status code in there. : (

@bpicolo
Copy link
Contributor Author

bpicolo commented Jul 7, 2015

Fyi, going to cut a branch to fix this in swaggerpy (because it's a necessary requirement for me)

@analogue
Copy link
Contributor

analogue commented Jul 7, 2015

The same work to expose the the request/response on HTTPError needs to be done for bravado on the master branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants