Show server error detail in endpoint failure messages#550
Conversation
The error response body includes both `message` and `error` fields, but only `message` was shown. Now displays the actual error detail to help diagnose issues like the Reset All Failed Builds 500. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
📝 WalkthroughWalkthroughUpdated error message construction in the authenticated endpoint hook to provide more detailed error information by combining error message and error detail fields when available, with fallbacks to simpler messages. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Visit the preview URL for this PR (updated for commit 9eddd15): https://game-ci-5559f--pr550-fix-error-detail-dis-jtqh47mb.web.app (expires Sat, 04 Apr 2026 23:56:08 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 1f0574f15f83e11bfc148eae8646486a6d0e078b |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/core/hooks/use-authenticated-endpoint.tsx`:
- Around line 21-22: In use-authenticated-endpoint (around the const detail
assignment) avoid composing `"undefined: ..."` by building the error text from
only defined parts: combine body.message and body.error with a separator only if
they exist (e.g., join non-empty values), assign that result to detail, then
throw new Error(detail || `Request failed (${response.status})`); update the
logic that sets detail (currently referencing body.message and body.error) so it
filters out undefined/null/empty values before joining.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 67211d6a-962d-4356-b8d5-88d529f910ab
📒 Files selected for processing (1)
src/core/hooks/use-authenticated-endpoint.tsx
| const detail = body.error ? `${body.message}: ${body.error}` : body.message; | ||
| throw new Error(detail || `Request failed (${response.status})`); |
There was a problem hiding this comment.
Avoid "undefined: ..." in composed server error messages.
If body.error is present but body.message is absent, Line 21 can produce a malformed message (for example, "undefined: actual error"). Build the message from available parts only.
Suggested fix
- const detail = body.error ? `${body.message}: ${body.error}` : body.message;
+ const detail = [body.message, body.error].filter(Boolean).join(': ');
throw new Error(detail || `Request failed (${response.status})`);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const detail = body.error ? `${body.message}: ${body.error}` : body.message; | |
| throw new Error(detail || `Request failed (${response.status})`); | |
| const detail = [body.message, body.error].filter(Boolean).join(': '); | |
| throw new Error(detail || `Request failed (${response.status})`); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@src/core/hooks/use-authenticated-endpoint.tsx` around lines 21 - 22, In
use-authenticated-endpoint (around the const detail assignment) avoid composing
`"undefined: ..."` by building the error text from only defined parts: combine
body.message and body.error with a separator only if they exist (e.g., join
non-empty values), assign that result to detail, then throw new Error(detail ||
`Request failed (${response.status})`); update the logic that sets detail
(currently referencing body.message and body.error) so it filters out
undefined/null/empty values before joining.

Summary
useAuthenticatedEndpointhook was only showingbody.messagefrom error responses, discarding the actual error detail inbody.errorTest plan
Generated with Claude Code
Summary by CodeRabbit