fix(providers): match google submodule imports and walk full exception chain

Co-Authored-By: Ahmed Allam <ahmed39652003@gmail.com>
This commit is contained in:
0xallam
2026-07-10 07:21:47 -07:00
committed by Ahmed Allam
parent f2b812a678
commit f0e8741705
2 changed files with 33 additions and 6 deletions
+19
View File
@@ -46,6 +46,25 @@ def test_bedrock_boto3_hint_for_litellm_wrapped_connection_error() -> None:
assert BEDROCK_EXTRA_NAME in hint
def test_vertex_google_submodule_hint() -> None:
exc = ModuleNotFoundError("No module named 'google.auth'")
hint = _provider_import_hint(exc, VERTEX_MODEL)
assert hint is not None
assert INSTALL_EXTRA_COMMAND_FRAGMENT in hint
assert VERTEX_EXTRA_NAME in hint
def test_vertex_google_hint_for_deeply_chained_error() -> None:
root = ModuleNotFoundError("No module named 'google.auth'")
middle = RuntimeError("provider init failed")
middle.__cause__ = root
exc = ConnectionError("litellm.APIConnectionError: request failed")
exc.__cause__ = middle
hint = _provider_import_hint(exc, VERTEX_MODEL)
assert hint is not None
assert VERTEX_EXTRA_NAME in hint
def test_non_import_error_returns_none() -> None:
assert _provider_import_hint(ConnectionError("boom"), "bedrock/whatever") is None