Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

Fix: Ensure exception is not None before checking its string representation (#12209)

Cole McIntoshabe364c2bcd8
diff --git a/tests/test_litellm/proxy/client/cli/test_keys_commands.py b/tests/test_litellm/proxy/client/cli/test_keys_commands.py
index aaaedc458f4..1347a776b1b 100644
--- a/tests/test_litellm/proxy/client/cli/test_keys_commands.py
+++ b/tests/test_litellm/proxy/client/cli/test_keys_commands.py
@@ -119,4 +119,6 @@ def test_keys_delete_error_handling(mock_keys_client, cli_runner):
mock_keys_client.return_value.delete.side_effect = Exception("API Error")
result = cli_runner.invoke(cli, ["keys", "delete", "--keys", "abc123"])
assert result.exit_code != 0
+ # Check that the exception is properly propagated
+ assert result.exception is not None
assert "API Error" in str(result.exception)