Skip to content

Commit

Permalink
I modified app.py to make changes mentioned in issue middlewarehq#561
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicghizzoni committed Oct 3, 2024
1 parent c5657d0 commit 4d119b0
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion backend/analytics_server/app.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from os import getenv

from flask import Flask
from flask import Flask, jsonify
from werkzeug.exceptions import HTTPException

from env import load_app_env

Expand Down Expand Up @@ -36,5 +37,19 @@
configure_db_with_app(app)
initialize_database(app)

def handle_exception(e):
if isinstance(e, HTTPException):
return jsonify({
"error": e.name,
"description": e.description,
"status_code": e.code
}), e.code

return jsonify({
"error": "Internal Server Error",
"description": str(e),
"status_code": 500
}), 500

if __name__ == "__main__":
app.run(port=ANALYTICS_SERVER_PORT)

0 comments on commit 4d119b0

Please sign in to comment.