Add clear message for 529 transient provider errors#209
Add clear message for 529 transient provider errors#209saarnilauri wants to merge 6 commits intoWordPress:trunkfrom
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## trunk #209 +/- ##
============================================
+ Coverage 87.45% 87.92% +0.46%
Complexity 1194 1194
============================================
Files 60 60
Lines 3858 3859 +1
============================================
+ Hits 3374 3393 +19
+ Misses 484 466 -18
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@saarnilauri I'm not sure why we need this, see WordPress/ai-provider-for-anthropic#3 (comment). Let's discuss on that issue since that's the source of where this came from. Then we can act on this PR accordingly once we have identified the path forward. |
afda492 to
af369c6
Compare
|
@felixarntz I rewrote the PR based on the discussin on WordPress/ai-provider-for-anthropic#3 (comment) I added unit tests for the ServerException |
Add
ProviderUnavailableExceptionfor transient provider errorsRelates to WordPress/ai-provider-for-anthropic#3
What
Adds a new
ProviderUnavailableExceptiontophp-ai-client, following the same pattern asTokenLimitReachedException.Why
When a provider returns a transient error (e.g. a
529 Overloaded,500,502, or503), there was no dedicated exception to represent that state. The raw HTTP client error was surfaced directly, making it impossible for consumers to handle or retry cleanly.Changes
src/Common/Exception/ProviderUnavailableException.php— extendsRuntimeException, stores the HTTP status code and API error type for downstream usetests/unit/Exceptions/ExceptionsTest.php— unit tests covering inheritance, default null values, and stored propertiesUsage (by providers)