feat(ai-proxy): add UnauthorizedError/TooManyRequestsError and typed AI provider errors#1474
Open
feat(ai-proxy): add UnauthorizedError/TooManyRequestsError and typed AI provider errors#1474
Conversation
3 new issues
|
|
Coverage Impact ⬆️ Merging this pull request will increase total coverage on Modified Files with Diff Coverage (6)
🛟 Help
|
Base automatically changed from
refactor/move-http-errors-to-agent-toolkit
to
main
February 18, 2026 10:26
…AI provider errors - Add UnauthorizedError (401) and TooManyRequestsError (429) to agent-toolkit - Re-export from datasource-toolkit for backward compatibility - Add HTTP codes and cases in agent error-handling middleware - Create AIProviderError, AIRateLimitError, AIAuthenticationError in ai-proxy with baseBusinessErrorName overrides for correct HTTP status mapping - Update wrapProviderError to use typed errors instead of generic AIUnprocessableError Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add `status` property to BusinessError and all subclasses, simplifying the error-handling middleware from a 30-line switch/case to a direct status lookup. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…r class The provider name and cause detail are now assembled by the constructor, simplifying wrapProviderError callers. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tibility The simplified error.status lookup would break if the user upgrades agent without upgrading datasource-toolkit (old errors lack the status property). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…rror, AIAuthenticationError Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
d397d17 to
7057a1c
Compare
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
7057a1c to
d189c01
Compare
…r classes Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ify constructor - AIRateLimitError -> AITooManyRequestsError (matches TooManyRequestsError) - AIAuthenticationError -> AIUnauthorizedError (matches UnauthorizedError) - Remove message from AIProviderError options, build it from cause - Type cause as Error instead of unknown Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary