rairo commited on
Commit
eeb5515
·
verified ·
1 Parent(s): 61ed245

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +10 -0
main.py CHANGED
@@ -105,6 +105,16 @@ def _log_response(resp):
105
  resp.headers["X-Request-Id"] = getattr(g, "request_id", "-")
106
  return resp
107
 
 
 
 
 
 
 
 
 
 
 
108
  @app.errorhandler(Exception)
109
  def _unhandled_exception(err):
110
  logger.exception(
 
105
  resp.headers["X-Request-Id"] = getattr(g, "request_id", "-")
106
  return resp
107
 
108
+
109
+ from werkzeug.exceptions import HTTPException
110
+
111
+ @app.errorhandler(HTTPException)
112
+ def handle_http_exception(err):
113
+ return jsonify({
114
+ "status": "error",
115
+ "message": err.description,
116
+ }), err.code
117
+
118
  @app.errorhandler(Exception)
119
  def _unhandled_exception(err):
120
  logger.exception(