ashb commented on code in PR #52968:
URL: https://github.com/apache/airflow/pull/52968#discussion_r2189434918


##########
task-sdk/src/airflow/sdk/execution_time/context.py:
##########
@@ -272,7 +273,12 @@ class ConnectionAccessor:
     """Wrapper to access Connection entries in template."""
 
     def __getattr__(self, conn_id: str) -> Any:
-        return _get_connection(conn_id)
+        try:
+            return _get_connection(conn_id)
+        except AirflowRuntimeError as e:
+            if e.error.error == ErrorType.CONNECTION_NOT_FOUND:
+                raise AirflowNotFoundException(f"The conn_id `{conn_id}` isn't 
defined")

Review Comment:
   ```suggestion
                   raise AirflowNotFoundException(f"The conn_id `{conn_id}` 
isn't defined") from None
   ```
   As I don't think we want the original exec to be recorded as the cause here



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