mik-laj commented on a change in pull request #12305:
URL: https://github.com/apache/airflow/pull/12305#discussion_r522006900



##########
File path: airflow/www/extensions/init_views.py
##########
@@ -134,12 +134,29 @@ def init_error_handlers(app: Flask):
 
 
 def init_api_connexion(app: Flask) -> None:
+
+    base_path = '/api/v1'
+
+    from airflow.www import views
+
+    @app.errorhandler(404)
+    @app.errorhandler(405)
+    def _handle_api_error(ex):
+        if request.path.startswith(base_path):
+            # 404 errors are never handled on the blueprint level
+            # unless raised from a view func so actual 404 errors,
+            # i.e. "no route for it" defined, need to be handled
+            # here on the application level
+            return common_error_handler(ex)
+        else:
+            return views.circles(ex)
+
     """Initialize Stable API"""

Review comment:
       This should be the first line in this function.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to