Skip to content

fix(ai-proxy): use proper AI error classes instead of generic Error#1520

Merged
Scra3 merged 1 commit intomainfrom
fix/ai-proxy-error-inheritance
Mar 31, 2026
Merged

fix(ai-proxy): use proper AI error classes instead of generic Error#1520
Scra3 merged 1 commit intomainfrom
fix/ai-proxy-error-inheritance

Conversation

@Scra3
Copy link
Copy Markdown
Member

@Scra3 Scra3 commented Mar 31, 2026

Summary

  • ForestIntegrationClient.checkConnection() threw new Error(...) for unsupported integrations → now throws AIBadRequestError
  • assertResponseOk() in Zendesk utils threw new Error(...) for API failures → now throws AIToolUnprocessableError
  • Add CLAUDE.md to ai-proxy package with error handling guidelines

Without proper error classes, the agent's error middleware maps these to a generic 500 instead of the correct HTTP status code.

Test plan

  • All 224 ai-proxy tests pass
  • Lint passes

🤖 Generated with Claude Code

Note

Replace generic Error with typed AI error classes in ai-proxy

  • ForestIntegrationClient.checkConnection now throws AIBadRequestError instead of a generic Error for unsupported integrations.
  • zendesk/utils.assertResponseOk now throws AIToolUnprocessableError instead of a generic Error on non-OK responses.
  • Adds a CLAUDE.md documenting the package's error handling policy: all thrown errors must extend AI error classes from src/errors.ts.

Macroscope summarized e5b5dd1.

@Scra3 Scra3 force-pushed the fix/ai-proxy-error-inheritance branch from d60aef7 to 7eb24c5 Compare March 31, 2026 15:16
- ForestIntegrationClient.checkConnection(): Error → AIBadRequestError
- assertResponseOk(): Error → AIToolUnprocessableError
- Add CLAUDE.md with error handling guidelines

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Scra3 Scra3 force-pushed the fix/ai-proxy-error-inheritance branch from 7eb24c5 to e5b5dd1 Compare March 31, 2026 15:17
@qltysh
Copy link
Copy Markdown

qltysh bot commented Mar 31, 2026

Qlty

Coverage Impact

This PR will not change total coverage.

Modified Files with Diff Coverage (2)

RatingFile% DiffUncovered Line #s
Coverage rating: A Coverage rating: A
packages/ai-proxy/src/forest-integration-client.ts100.0%
Coverage rating: A Coverage rating: A
packages/ai-proxy/src/integrations/zendesk/utils.ts100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@Scra3 Scra3 merged commit 54ff837 into main Mar 31, 2026
29 checks passed
@Scra3 Scra3 deleted the fix/ai-proxy-error-inheritance branch March 31, 2026 15:29
forest-bot added a commit that referenced this pull request Mar 31, 2026
## @forestadmin/ai-proxy [1.7.1](https://github.com/ForestAdmin/agent-nodejs/compare/@forestadmin/ai-proxy@1.7.0...@forestadmin/ai-proxy@1.7.1) (2026-03-31)

### Bug Fixes

* **ai-proxy:** use proper AI error classes instead of generic Error ([#1520](#1520)) ([54ff837](54ff837))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants