mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 19:24:27 +00:00
fix(utils.py): fix exception_mapping check for errors
If exception already mapped - don't attach traceback to it
This commit is contained in:
parent
5842f429c5
commit
40bd069c39
2 changed files with 9 additions and 11 deletions
|
@ -5914,6 +5914,7 @@ def exception_type(
|
|||
)
|
||||
else:
|
||||
# if no status code then it is an APIConnectionError: https://github.com/openai/openai-python#handling-errors
|
||||
# exception_mapping_worked = True
|
||||
raise APIConnectionError(
|
||||
message=f"APIConnectionError: {exception_provider} - {message}",
|
||||
llm_provider=custom_llm_provider,
|
||||
|
@ -7460,6 +7461,9 @@ def exception_type(
|
|||
if exception_mapping_worked:
|
||||
raise e
|
||||
else:
|
||||
for error_type in litellm.LITELLM_EXCEPTION_TYPES:
|
||||
if isinstance(e, error_type):
|
||||
raise e # it's already mapped
|
||||
raise APIConnectionError(
|
||||
message="{}\n{}".format(original_exception, traceback.format_exc()),
|
||||
llm_provider="",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue