Browse Source

WIP exception handling.

scossu 4 months ago
parent
commit
ad4c7b23e7
1 changed files with 9 additions and 0 deletions
  1. 9 0
      scriptshifter/rest_api.py

+ 9 - 0
scriptshifter/rest_api.py

@@ -7,6 +7,7 @@ from os import environ, urandom
 
 from flask import Flask, jsonify, render_template, request
 
+from scriptshifter.exceptions import ApiError
 from scriptshifter.tables import list_tables, load_table
 from scriptshifter.trans import transliterate
 
@@ -31,6 +32,14 @@ def create_app():
 app = create_app()
 
 
+#@app.exception_handler(ApiError)
+#def handle_exception(request: Request, e: ApiError):
+#    return JSONResponse(
+#        content=e.to_json(),
+#        status_code=e.status_code
+#    )
+
+
 @app.route("/", methods=["GET"])
 def index():
     return render_template("index.html", languages=list_tables())