feat(exceptions): standardize provider error __str__ format#167
Conversation
Add error_type class attribute and __str__ override to ProviderError and subclasses, producing consistent [provider] type: message output across all LLM providers. Co-Authored-By: Paperclip <noreply@paperclip.ing>
The __str__ override dropped self.details from the output, which broke existing tests that match on details keywords (e.g., 'available_embedders', 'available_retrievers'). Include non-provider_name details in the standardized format, matching the base OpenAgentEvalError behavior. Co-Authored-By: Paperclip <noreply@paperclip.ing>
|
Thanks for the review! I found the issue — the Fixed in the latest commit: the All unit tests pass locally. CI should be green now. |
|
The Local verification (Python 3.13):
CI status: The latest CI run needs maintainer approval (first-time contributor policy). Could you approve the workflow? The previous run was at Pre-existing unrelated failures in CI (missing optional |
|
🎉 Congratulations @lesbass! Your pull request has been successfully merged into main. 🚀 Thank you for contributing to OpenAgentHQ and helping improve the project. We truly appreciate your contribution and hope to see you back with more amazing PRs! Happy Open Sourcing! ❤️ 🌟 This is your first merged contribution to this repository. |

Closes #113
Summary
Adds
error_typeclass attribute and__str__override toProviderErrorand its subclasses, producing a consistent[provider] error_type: messageformat across all LLM providers.Changes
openagent_eval/exceptions/provider.py: Addederror_typeclass attribute and__str__override toProviderError,ProviderNotFoundError,ProviderConnectionError, andProviderExecutionErrortests/unit/test_exceptions.py: Updated tests for new standardized format, added format tests with provider nameFormat
error_typeProviderError"Provider Error"[openai] Provider Error: API key not foundProviderNotFoundError"Provider Not Found"[my_provider] Provider Not Found: Provider not found: my_providerProviderConnectionError"Connection Error"[gemini] Connection Error: Failed to connectProviderExecutionError"Execution Error"[anthropic] Execution Error: API call failedWhen
provider_nameis None, the[...]prefix is omitted.Verification