Skip to content

Show server error detail in endpoint failure messages#550

Merged
frostebite merged 1 commit intomainfrom
fix/error-detail-display
Mar 28, 2026
Merged

Show server error detail in endpoint failure messages#550
frostebite merged 1 commit intomainfrom
fix/error-detail-display

Conversation

@frostebite
Copy link
Copy Markdown
Member

@frostebite frostebite commented Mar 28, 2026

Summary

  • The useAuthenticatedEndpoint hook was only showing body.message from error responses, discarding the actual error detail in body.error
  • Now displays both: e.g. "Internal error during reset: " instead of just "Internal error during reset"
  • Helps diagnose the Reset All Failed Builds 500 error

Test plan

  • Click Reset All Failed Builds as admin
  • If it fails, verify the toast now shows the actual server error message instead of the generic one

Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error message display for API request failures with more comprehensive details when available.

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>
@github-actions
Copy link
Copy Markdown

Cat Gif

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 28, 2026

📝 Walkthrough

Walkthrough

Updated 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

Cohort / File(s) Summary
Error Message Enhancement
src/core/hooks/use-authenticated-endpoint.tsx
Improved error message construction to include both body.message and body.error when both are present, with multiple fallback levels for different error response scenarios.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

🐰 A little hop, a tweak so fine,
Error messages now combine!
When details dance with message bright,
Users see what went not right. ✨

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description provides a clear summary of changes and test plan but does not follow the required template structure with 'Changes' and 'Checklist' sections. Restructure the description to include the 'Changes' section with bullet points and the 'Checklist' section with the required items from the repository template.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Show server error detail in endpoint failure messages' accurately and concisely describes the main change: enhancing error messages to display server error details.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/error-detail-display

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

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

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between d163771 and 9eddd15.

📒 Files selected for processing (1)
  • src/core/hooks/use-authenticated-endpoint.tsx

Comment on lines +21 to +22
const detail = body.error ? `${body.message}: ${body.error}` : body.message;
throw new Error(detail || `Request failed (${response.status})`);
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

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.

Suggested change
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.

@frostebite frostebite merged commit 9a323e9 into main Mar 28, 2026
10 checks passed
@frostebite frostebite deleted the fix/error-detail-display branch March 28, 2026 23:56
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.

1 participant