diff --git a/litellm/tests/test_completion.py b/litellm/tests/test_completion.py index 45a53ca56..d08a4ae3b 100644 --- a/litellm/tests/test_completion.py +++ b/litellm/tests/test_completion.py @@ -3342,6 +3342,8 @@ def test_completion_watsonx(): print(response) except litellm.APIError as e: pass + except litellm.RateLimitError as e: + pass except Exception as e: pytest.fail(f"Error occurred: {e}") diff --git a/litellm/utils.py b/litellm/utils.py index 14534147b..4a8e7e691 100644 --- a/litellm/utils.py +++ b/litellm/utils.py @@ -8514,7 +8514,7 @@ def exception_type( request=original_exception.request, ) elif custom_llm_provider == "watsonx": - if "token_quota_reached" in error_response: + if "token_quota_reached" in error_str: exception_mapping_worked = True raise RateLimitError( message=f"WatsonxException: Rate Limit Errror - {error_str}",