Skip to content

Commit 13c7272

Browse files
GWealecopybara-github
authored andcommitted
fix: include credential failure details
The Parameter Manager configuration error used a plain string with the exception placeholder left uninterpolated, so callers saw the literal placeholder instead of the default-credential exception that explained the failure. This interpolates the caught exception into the raised ValueError. Co-authored-by: George Weale <gweale@google.com> PiperOrigin-RevId: 949190934
1 parent 4a84d8a commit 13c7272

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

src/google/adk/integrations/parameter_manager/parameter_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def __init__(
9696
except Exception as e:
9797
raise ValueError(
9898
"'service_account_json' or 'auth_token' are both missing, and"
99-
" error occurred while trying to use default credentials: {e}"
99+
f" error occurred while trying to use default credentials: {e}"
100100
) from e
101101

102102
if not credentials:

tests/unittests/integrations/parameter_manager/test_parameter_client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ def test_init_with_default_credentials_error(
163163
# Execute and verify
164164
with pytest.raises(
165165
ValueError,
166-
match="error occurred while trying to use default credentials",
166+
match=(
167+
"error occurred while trying to use default credentials: Auth error"
168+
),
167169
):
168170
ParameterManagerClient()
169171

0 commit comments

Comments
 (0)