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

Successful html codes on failure #87

Open
bmschmidt opened this issue Oct 27, 2015 · 1 comment
Open

Successful html codes on failure #87

bmschmidt opened this issue Oct 27, 2015 · 1 comment

Comments

@bmschmidt
Copy link
Member

Note: this is just a copy of the issue filed by @organisciak at Bookworm-project/BookwormAPI#16, because the problem lives here now.


When the BookwormAPI fails, it doesn't send an HTML error code for clients to interpret.

Since the most recent commit, I can't find any failed queries from BookwormGUI, so this is low priority, I suppose. Here's a simulated query with an error, which provides a 200 Status Code:

http://bookworm.htrc.illinois.edu/cgi-bin/dbbindings.py?query={%22groups%22:[%22date_year%22],%22counttype%22:%22WordsPerMillion%22,%22words_collation%22:%22Case_Sensitive%22,%22database%22:%22hathipd%22,%22search_limits%22:[{%22word%22:[%22\\\%22],%22date_year%22:{%22$gte%22:1750,%22$lte%22:1923}}],%22method%22:%22return_json%22}

@bmschmidt bmschmidt changed the title https://github.com/Bookworm-project/BookwormAPI/issues/16 Successful html codes on failure Oct 27, 2015
@bmschmidt
Copy link
Member Author

There are two different types of errors:

  1. Something breaks in the code and it actually raises an error

  2. The query breaks in a predictable way that can yield a blank response. For instance, if a searched-for word is not in the database, or if the user specifies a metadata field that doesn't exist. Rather than throwing a blanket 500 error, it would be nice to send a specific message like

{"error":"No bookworm database of that name is available on the server"}

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

1 participant