diff --git a/litellm/litellm_core_utils/exception_mapping_utils.py b/litellm/litellm_core_utils/exception_mapping_utils.py index b844b44bb56..2c1d92920af 100644 --- a/litellm/litellm_core_utils/exception_mapping_utils.py +++ b/litellm/litellm_core_utils/exception_mapping_utils.py @@ -2313,7 +2313,7 @@ def exception_type( # type: ignore # noqa: PLR0915 else: # if no status code then it is an APIConnectionError: https://github.com/openai/openai-python#handling-errors raise APIConnectionError( - message=f"{exception_provider} APIConnectionError - {message}\n{redact_string(traceback.format_exc()) if _ENABLE_SECRET_REDACTION else traceback.format_exc()}", + message=f"{exception_provider} APIConnectionError - {message}\n{_redact_string(traceback.format_exc())}", llm_provider="azure", model=model, litellm_debug_info=extra_information, @@ -2441,9 +2441,7 @@ def exception_type( # type: ignore # noqa: PLR0915 raise APIConnectionError( message="{}\n{}".format( str(original_exception), - redact_string(traceback.format_exc()) - if _ENABLE_SECRET_REDACTION - else traceback.format_exc(), + _redact_string(traceback.format_exc()), ), llm_provider=custom_llm_provider, model=model, @@ -2474,9 +2472,7 @@ def exception_type( # type: ignore # noqa: PLR0915 raised_exc = APIConnectionError( message="{}\n{}".format( original_exception, - redact_string(traceback.format_exc()) - if _ENABLE_SECRET_REDACTION - else traceback.format_exc(), + _redact_string(traceback.format_exc()), ), llm_provider="", model="",