amoghrajesh commented on PR #46406:
URL: https://github.com/apache/airflow/pull/46406#issuecomment-2635797976

   @jscheffl I gave it some thought and this is what I think:
   
   The part of code that returns 500:
   ```
       result = query.with_entities(BaseXCom.value).first()
   
       if result is None:
           raise HTTPException(
               status_code=status.HTTP_404_NOT_FOUND,
               detail={
                   "reason": "not_found",
                   "message": f"XCom with key '{key}' not found for task 
'{task_id}' in DAG '{dag_id}'",
               },
           )
   
       try:
           xcom_value = BaseXCom.orm_deserialize_value(result)
       except json.JSONDecodeError:
           raise HTTPException(
               status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
               detail={
                   "reason": "invalid_format",
                   "message": "XCom value is not a valid JSON",
               },
           )
   
       return XComResponse(key=key, value=xcom_value)
   ```
   
   
   As observed in:
   ```
      try:
           xcom_value = BaseXCom.orm_deserialize_value(result)
       except json.JSONDecodeError:
           raise HTTPException(
               status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
               detail={
                   "reason": "invalid_format",
                   "message": "XCom value is not a valid JSON",
               },
           )
   ```
   
   Here, `result` is also something that comes from the server. So, the issue 
is actually is at the server end and not the client. 400 would be ideal if 
there's some issue with what the client sent, 4xx stands for client side 
errors. 
   
   Does that make sense?
   
   
   


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