mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-25 10:44:24 +00:00
fix(bedrock.py): add exception mapping coverage for authentication scenarios
This commit is contained in:
parent
142750adff
commit
1c4dd0671b
3 changed files with 29 additions and 8 deletions
|
@ -2946,14 +2946,14 @@ def exception_type(
|
|||
model=model,
|
||||
llm_provider="bedrock"
|
||||
)
|
||||
if "Unable to locate credentials" in error_str or "Malformed input request" in error_str:
|
||||
if "Malformed input request" in error_str:
|
||||
exception_mapping_worked = True
|
||||
raise InvalidRequestError(
|
||||
message=f"BedrockException - {error_str}",
|
||||
model=model,
|
||||
llm_provider="bedrock"
|
||||
)
|
||||
if "The security token included in the request is invalid" in error_str:
|
||||
if "Unable to locate credentials" in error_str or "The security token included in the request is invalid" in error_str:
|
||||
exception_mapping_worked = True
|
||||
raise AuthenticationError(
|
||||
message=f"BedrockException Invalid Authentication - {error_str}",
|
||||
|
@ -2975,6 +2975,13 @@ def exception_type(
|
|||
llm_provider="bedrock",
|
||||
model=model
|
||||
)
|
||||
elif original_exception.status_code == 401:
|
||||
exception_mapping_worked = True
|
||||
raise AuthenticationError(
|
||||
message=f"BedrockException - {original_exception.message}",
|
||||
llm_provider="bedrock",
|
||||
model=model
|
||||
)
|
||||
elif custom_llm_provider == "sagemaker":
|
||||
if "Unable to locate credentials" in error_str:
|
||||
exception_mapping_worked = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue