kaxil commented on code in PR #45043:
URL: https://github.com/apache/airflow/pull/45043#discussion_r1891187633
##########
task_sdk/src/airflow/sdk/api/client.py:
##########
@@ -161,9 +164,19 @@ class ConnectionOperations:
def __init__(self, client: Client):
self.client = client
- def get(self, conn_id: str) -> ConnectionResponse:
+ def get(self, conn_id: str) -> ConnectionResponse | ErrorResponse:
"""Get a connection from the API server."""
- resp = self.client.get(f"connections/{conn_id}")
+ try:
+ resp = self.client.get(f"connections/{conn_id}")
+ except ServerResponseError as e:
+ if e.response.status_code == HTTPStatus.NOT_FOUND:
+ log.error(
+ "Connection not found",
+ conn_id=conn_id,
+ detail=e.detail,
+ status_code=e.response.status_code,
+ )
+ return ErrorResponse(error=ErrorType.CONNECTION_NOT_FOUND,
detail={"conn_id": conn_id})
Review Comment:
Open to other ideas though: We just need a way for the connection requestor
(in ConnectionAccessor in Task Runner via SUPERVISOR_COMMS) to know that the
connection wasn't found. Since, it will need something when it does
`SUPERVISOR_COMMS.get_message`.
--
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]