diff --git a/quit/web/modules/endpoint.py b/quit/web/modules/endpoint.py index 58b8ccd8..690b7b45 100644 --- a/quit/web/modules/endpoint.py +++ b/quit/web/modules/endpoint.py @@ -160,6 +160,22 @@ def sparql(branch_or_ref): else: response.headers["X-CurrentCommit"] = commitid return response + except KeyError as e: + logger.exception(e) + if "config value 'user.name' was not found" in e.args: + message = ("Unable to process query: " + "git config value 'user.name' was not found.\n" + "Pls use the following command in your data repo:" + "\n\n git config user.name ") + return make_response(message, 400) + if "config value 'user.email' was not found" in e.args: + message = ("Unable to process query: " + "git config value 'user.name' was not found.\n" + "Pls use the following command in your data repo:" + "\n\n git config user.email ") + return make_response(message, 400) + # KeyError has many sources -> it could be caused by other problems + return make_response('Error after executing the update query.', 400) except Exception as e: # query ok, but unsupported query type or other problem during commit logger.exception(e) diff --git a/quit/web/modules/git.py b/quit/web/modules/git.py index b59928ee..c28a4975 100644 --- a/quit/web/modules/git.py +++ b/quit/web/modules/git.py @@ -258,7 +258,21 @@ def merge(refspec): return response else: return "
Unsupported Mimetype: {}
".format(mimetype), 406 - + except KeyError as e: + message = "\n" + if "config value 'user.name' was not found" in e.args: + message += ("Unable to process query: " + "git config value 'user.name' was not found.\n" + "Pls use the following command in your data repo:" + "\n\n git config user.name ") + if "config value 'user.email' was not found" in e.args: + message += ("Unable to process query: " + "git config value 'user.name' was not found.\n" + "Pls use the following command in your data repo:" + "\n\n git config user.email ") + logger.error(e) + logger.error(traceback.format_exc()) + return "
" + traceback.format_exc() + message + "
", 400 except Exception as e: logger.error(e) logger.error(traceback.format_exc())