mykola-shyshov commented on issue #58065:
URL: https://github.com/apache/airflow/issues/58065#issuecomment-3508744474

   The easiest solution for me is to include the error details in the response. 
The potential downside is security concerns (I’m not entirely sure about this).
   ``` airflow-core/src/airflow/api_fastapi/execution_api/app.py
       @app.exception_handler(Exception)
       def handle_exceptions(request: Request, exc: Exception):
           logger.exception("Handle died with an error", exc_info=(type(exc), 
exc, exc.__traceback__))
           content = {
               "message": "Internal server error",
               "details": str(exc) or "" # <---- HERE
           }
           if correlation_id := request.headers.get("correlation-id"):
               content["correlation-id"] = correlation_id
           return JSONResponse(status_code=500, content=content)
   
       return app
   ```
   
   What I would probably also do is wrap the server error into a custom error 
object to avoid confusing clients with raw API calls  exceptions.
   


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