Commit 50615341 authored by John Wang's avatar John Wang

feat: add cause in APIConnectionError msg

parent eceb4209
...@@ -119,8 +119,8 @@ class AnthropicProvider(BaseProvider): ...@@ -119,8 +119,8 @@ class AnthropicProvider(BaseProvider):
] ]
chat_llm(messages) chat_llm(messages)
except anthropic.APIConnectionError: except anthropic.APIConnectionError as ex:
raise ValidateFailedError(f"Anthropic: Connection error.") raise ValidateFailedError(f"Anthropic: Connection error, cause: {ex.__cause__}")
except (anthropic.APIStatusError, anthropic.RateLimitError) as ex: except (anthropic.APIStatusError, anthropic.RateLimitError) as ex:
raise ValidateFailedError(f"Anthropic: Error code: {ex.status_code} - " raise ValidateFailedError(f"Anthropic: Error code: {ex.status_code} - "
f"{ex.body['error']['type']}: {ex.body['error']['message']}") f"{ex.body['error']['type']}: {ex.body['error']['message']}")
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment