-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Fix consistency in exception/log handling in connection.py
#50329
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -478,7 +478,6 @@ def get_connection_from_secrets(cls, conn_id: str) -> Connection: | |
| return conn | ||
| except AirflowRuntimeError as e: | ||
| if e.error.error == ErrorType.CONNECTION_NOT_FOUND: | ||
| log.debug("Unable to retrieve connection from MetastoreBackend using Task SDK") | ||
| raise AirflowNotFoundException(f"The conn_id `{conn_id}` isn't defined") | ||
| raise | ||
|
|
||
|
|
@@ -498,7 +497,7 @@ def get_connection_from_secrets(cls, conn_id: str) -> Connection: | |
| SecretCache.save_connection_uri(conn_id, conn.get_uri()) | ||
| return conn | ||
| except Exception: | ||
| log.debug( | ||
| log.exception( | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I originally changed this to log.debug in PR #47648 because I misunderstood the behaviour. Using log.exception ensures that when there's a genuine error accessing a secrets backend (not just a missing connection), we get the full error details for debugging. We could also just set
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @ramitkataria The one you changed in PR #47648 is the different one I am referring to here. You already removed
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AH thanks. |
||
| "Unable to retrieve connection from secrets backend (%s). " | ||
| "Checking subsequent secrets backend.", | ||
| type(secrets_backend).__name__, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.