amoghrajesh commented on code in PR #71440:
URL: https://github.com/apache/airflow/pull/71440#discussion_r3759091599


##########
task-sdk/src/airflow/sdk/api/client.py:
##########
@@ -211,6 +211,13 @@ def raise_on_4xx_5xx_with_note(response: httpx.Response):
         e.add_note(
             f"Correlation-id={response.headers.get('correlation-id', None) or 
response.request.headers.get('correlation-id', 'no-correlation-id')}"
         )
+        # ServerResponseError keeps the server's error payload as structured 
``detail`` behind a
+        # generic message; attach it as a note too so the details survive in 
tracebacks that
+        # propagate uncaught to a generic logger (e.g. the executor), not only 
where a handler
+        # logs ``e.detail`` explicitly.

Review Comment:
   ```suggestion
           # .detail sits behind the generic message and only reaches logs 
where a handler
           # logs it by hand. Add it as a note too, so uncaught paths (e.g. the 
executor) keep it.
   
   ```
   
   nit.



##########
task-sdk/tests/task_sdk/api/test_client.py:
##########
@@ -197,6 +198,24 @@ def test_server_response_error_pickling(self):
         assert unpickled.response.status_code == 404
         assert unpickled.request.url == "http://error";
 
+    @pytest.mark.skipif(sys.version_info < (3, 11), reason="Exception notes 
(PEP 678) require Python 3.11")
+    def test_server_error_detail_added_as_note(self):
+        """The structured ``detail`` is attached as an exception note so it 
survives in tracebacks
+        that propagate uncaught to a generic logger (e.g. the executor), where 
only the generic
+        ``str(exc)`` message would otherwise be shown."""

Review Comment:
   ```suggestion
            """Notes survive uncaught propagation, handled sites still log 
detail directly."""
   ```



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