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

Error handler #324

Merged
merged 2 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from opengeodeweb_back import geode_functions
from opengeodeweb_back.routes import blueprint_routes
from opengeodeweb_back.geode_functions import handle_exception

from werkzeug.exceptions import HTTPException

Expand Down Expand Up @@ -94,17 +95,8 @@ def kill_task():


@app.errorhandler(HTTPException)
def handle_exception(e):
response = e.get_response()
response.data = flask.json.dumps(
{
"code": e.code,
"name": e.name,
"description": e.description,
}
)
response.content_type = "application/json"
return response
def errorhandler(e):
return handle_exception(e)


@app.route("/createbackend", methods=["POST"])
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ python-dotenv
Flask[async]
Flask-Cors
Werkzeug
OpenGeodeWeb-Back
OpengeodeWeb-Back
8 changes: 6 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#
# This file is autogenerated by pip-compile with Python 3.11
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile requirements.in
Expand Down Expand Up @@ -121,7 +121,7 @@ opengeode-io==6.5.1
# geode-viewables
# opengeode-geosciencesio
# opengeodeweb-back
opengeodeweb-back==4.1.1
opengeodeweb-back==4.2.0
# via -r requirements.in
python-dotenv==1.0.1
# via -r requirements.in
Expand All @@ -135,6 +135,10 @@ rpds-py==0.18.0
# jsonschema
# opengeodeweb-back
# referencing
typing-extensions==4.12.0
# via
# asgiref
# opengeodeweb-back
werkzeug==3.0.2
# via
# -r requirements.in
Expand Down
Loading