jason810496 commented on code in PR #49164:
URL: https://github.com/apache/airflow/pull/49164#discussion_r2313041358


##########
airflow-core/src/airflow/api_fastapi/common/exceptions.py:
##########
@@ -103,6 +104,18 @@ def _is_dialect_matched(self, exc: IntegrityError) -> bool:
         return False
 
 
-DatabaseErrorHandlers = [
-    _UniqueConstraintErrorHandler(),
-]
+class DagErrorHandler(BaseErrorHandler[DeserializationError]):
+    """Handler for Dag related errors."""
+
+    def __init__(self):
+        super().__init__(DeserializationError)

Review Comment:
   The change for `DagErrorHandler` LGTM.
   
   ---
   
   The original intention is to  have a way to handle some common exceptions 
for all routes.
   The `DagErrorHandler` will be added as FastAPI exception handler during the 
FastAPI app init.
   
   ```python
   def init_error_handlers(app: FastAPI) -> None:
       from airflow.api_fastapi.common.exceptions import ERROR_HANDLERS
   
       for handler in ERROR_HANDLERS:
           app.add_exception_handler(handler.exception_cls, 
handler.exception_handler)
   ```



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to