Trae Assistant commited on
Commit
bba1238
·
1 Parent(s): 253cabf

Fix: Add error handlers for 413 and 500

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -81,6 +81,14 @@ def delete_valuation(id):
81
  def health():
82
  return jsonify({"status": "healthy"})
83
 
 
 
 
 
 
 
 
 
84
  if __name__ == '__main__':
85
  port = int(os.environ.get('PORT', 7860))
86
  app.run(host='0.0.0.0', port=port)
 
81
  def health():
82
  return jsonify({"status": "healthy"})
83
 
84
+ @app.errorhandler(413)
85
+ def request_entity_too_large(error):
86
+ return jsonify({"error": "Request entity too large (max 16MB)"}), 413
87
+
88
+ @app.errorhandler(500)
89
+ def internal_server_error(error):
90
+ return jsonify({"error": "Internal Server Error"}), 500
91
+
92
  if __name__ == '__main__':
93
  port = int(os.environ.get('PORT', 7860))
94
  app.run(host='0.0.0.0', port=port)