Commit cb87c377 authored by Markus Scheidgen's avatar Markus Scheidgen
Browse files

Minimal clientlib error handling.

parent df37f11c
......@@ -52,6 +52,10 @@ from nomad.datamodel import EntryArchive
from nomad import parsing # pylint: disable=unused-import
class QueryError(Exception):
class KeycloakAuthenticator(bravado_requests_client.Authenticator):
def __init__(self, host, user, password, **kwargs):
......@@ -177,6 +181,14 @@ class ArchiveQuery(
response =, headers=self.authentication, json=self.query)
if response.status_code != 200:
if response.status_code == 400:
message = response.json().get('message')
errors = response.json().get('errors')
if message:
raise QueryError('%s: %s' % (message, errors))
raise QueryError('The query is invalid for unknown reasons.')
raise response.raise_for_status()
data = response.json
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment