SameerMesiah97 commented on code in PR #62400:
URL: https://github.com/apache/airflow/pull/62400#discussion_r2937316348
##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -180,14 +180,14 @@ def ti_run(
previous_state=previous_state,
)
- # TODO: Pass a RFC 9457 compliant error message in "detail" field
- # https://datatracker.ietf.org/doc/html/rfc9457
- # to provide more information about the error
- # FastAPI will automatically convert this to a JSON response
- # This might be added in FastAPI in
https://github.com/fastapi/fastapi/issues/10370
raise HTTPException(
status_code=status.HTTP_409_CONFLICT,
detail={
+ "type":
"https://airflow.apache.org/docs/apache-airflow/stable/stable-rest-api-ref.html#section/Errors/Conflict",
+ "title": "Task Instance Conflict",
+ "status": status.HTTP_409_CONFLICT,
+ "detail": "TI was not in a state where it could be marked as
running",
+ "instance": str(task_instance_id),
Review Comment:
According to RFC 9457:
The "instance" member is a JSON string containing a URI reference that
identifies the specific occurrence of the problem.
In that light, is `str(task_instance_id)` compliant?
##########
airflow-core/src/airflow/api_fastapi/execution_api/routes/task_instances.py:
##########
@@ -180,14 +180,14 @@ def ti_run(
previous_state=previous_state,
)
- # TODO: Pass a RFC 9457 compliant error message in "detail" field
- # https://datatracker.ietf.org/doc/html/rfc9457
- # to provide more information about the error
- # FastAPI will automatically convert this to a JSON response
- # This might be added in FastAPI in
https://github.com/fastapi/fastapi/issues/10370
raise HTTPException(
status_code=status.HTTP_409_CONFLICT,
detail={
+ "type":
"https://airflow.apache.org/docs/apache-airflow/stable/stable-rest-api-ref.html#section/Errors/Conflict",
+ "title": "Task Instance Conflict",
+ "status": status.HTTP_409_CONFLICT,
+ "detail": "TI was not in a state where it could be marked as
running",
+ "instance": str(task_instance_id),
"reason": "invalid_state",
"message": "TI was not in a state where it could be marked as
running",
Review Comment:
Isn't "message" just a duplicate of "detail"? Is this needed?
--
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]