BlueBrain / nexus-forge

Building and Using Knowledge Graphs made easy
https://nexus-forge.readthedocs.io
GNU Lesser General Public License v3.0
38 stars 19 forks source link

Systematically raise for status on request and uniformize exception handling #359

Closed ssssarah closed 9 months ago

ssssarah commented 9 months ago

There were some calls to Delta that didn't request.raise_for_status() and so there would be an attempt to parse the body even though there wasn't one. This was noticed for example when a forge instance would have its token expire and some error codes in requests would not be checked, the body would be parsed, and a json error would be thrown.

For all requests.___ calls, the same _catch_http_error is being called. This also improves code readability to avoid having the the same try-except block repeated across the file.

Adresses https://github.com/BlueBrain/nexus-forge/issues/164