-
Notifications
You must be signed in to change notification settings - Fork 12
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
New exceptions #108
New exceptions #108
Conversation
Super. I've almost got travis working, so may wait a minute to merge. Couple questions about syntax:
Is there/should there be spaces around the word "status", and not the other dict keys? If so, why?
|
Also, what do we need to do to merge dbbinding-flask.py and dbbindings.py back together? I don't want to start maintaining two codebases in parallel, and I can't remember what the flask one is doing now. |
There's an error above (my tab froze before posting, so I copied the text from a screenshot rather than rewriting). I'll edit it to avoid future confusion, but should be:
or tidier:
I'm using dbbindings-flask because it can be run as a self-standing app rather than existing in Noting that you have By the way, I misremembered in the original message, it looks like I did write the |
OK, a succesful Travis merge. Which doesn't mean too much because I don't think we're testing the new bookworm error formats. Let me know if you want some guidelines on unit tests. Here's one just for reference. https://github.com/Bookworm-project/BookwormDB/blob/master/tests/test_API.py#L126-L145 |
👍 On Mon, Aug 22, 2016, 1:34 PM Benjamin Schmidt [email protected]
|
There is now a BookwormException which you can explicitly raise with a dict in this style:
This is sent up the stack and caught when executing a query, which will return a JSEND-style response:
The codes, as mentioned in #95, are HTTP status codes. This makes it easy for the API to format its HTTP response to match what the backend provides. This is currently in
dbbinding-flask.py
, since that's what I test with. The reason you want both the JSend response and an HTTP code is because clients parse theHTTP code to see if the response should be handled as an error. Eg.
request.on("error", function(error) { callback(error); })
in D3.