harvard-lil / h2o

H2O is a web app for creating and reading open educational resources, primarily in the legal field
https://opencasebook.org
GNU Affero General Public License v3.0
36 stars 30 forks source link

Handle non-HTTP 200 responses in fetch calls; fixes #1981 #1985

Closed lizadaly closed 1 year ago

lizadaly commented 1 year ago

For the three new API calls that have been added using fetch(), handle cases where the response that comes back is not OK.

In most cases this just passes along an error message. In the case of search results, because this expects a list of lists, the error message will be inside the results data structure.

The error message gets displayed to the user under the text box in most places.