🐛 fix: handle runtime request errors#15478
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6eaed1d708
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## canary #15478 +/- ##
===========================================
+ Coverage 70.84% 88.62% +17.78%
===========================================
Files 3255 819 -2436
Lines 321112 91889 -229223
Branches 29340 7680 -21660
===========================================
- Hits 227496 81439 -146057
+ Misses 93434 10268 -83166
Partials 182 182
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
@codex review latest code |
|
Codex Review: Didn't find any major issues. Keep them coming! ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
💻 Change Type
🔗 Related Issue
N/A
🔀 Description of Change
aiChat.outputJSONinto nativeTRPCErrorinstances so expected provider/config/quota/request failures no longer surface as generic 500 errors.InvalidProviderAPIKeyas LobeHub session-expired errors inresponseMeta.🧪 How to Test
bunx vitest run --silent='passed-only' src/libs/oidc-provider/http-adapter.test.ts src/libs/trpc/utils/responseMeta.test.ts src/server/routers/lambda/__tests__/aiChat.test.ts vscode-cli get-diagnostics --workspace /Users/tj/code/lobehub-cloud📸 Screenshots / Videos
N/A
📝 Additional Information
The HTTP response status is still produced by tRPC from
TRPCError.code; this PR only normalizes model-runtime errors before they reach tRPC's defaultINTERNAL_SERVER_ERRORwrapper.The OIDC adapter test now also feeds a
/oidc/tokenform body throughoidc-provider's ownurlencodedparser to verifygrant_type,code,client_id,redirect_uri, andcode_verifierremain parseable from the Node readable stream.