Skip to content

feat: display friendly error messages on API failure#69

Closed
Ai-chan-0411 wants to merge 1 commit intoO2sa:mainfrom
Ai-chan-0411:feat/error-msg-issue34
Closed

feat: display friendly error messages on API failure#69
Ai-chan-0411 wants to merge 1 commit intoO2sa:mainfrom
Ai-chan-0411:feat/error-msg-issue34

Conversation

@Ai-chan-0411
Copy link
Copy Markdown
Contributor

closes #34

Summary

Replaces the generic red error box with a context-aware ErrorMessage component that provides actionable feedback based on the type of error.

Changes

  • components/error-message.tsx (new): ErrorMessage component that detects error type (user not found / rate limit / network / generic) and shows an appropriate title + description, with optional retry button
  • app/api/compare/route.ts: Returns specific error messages for rate limit (HTTP 403) and "user not found" cases, instead of a generic fallback
  • app/page.tsx: Replaces <div className="card p-4 text-sm text-red-600 ..."> with <ErrorMessage> component; minor layout improvements (flex flex-col / flex-1 w-full)

Before / After

Before:
Plain red box: Failed to calculate score

After:
Shadcn Alert (destructive variant) with icon, descriptive title, and human-readable message:

  • "User not found – The GitHub username you entered does not exist…"
  • "Rate limit exceeded – GitHub API rate limit has been reached…"
  • "Network error – Could not connect to the server…"
  • "Something went wrong – …" (fallback)

closes O2sa#34

Add user-friendly error messages when GitHub API calls fail:
- ErrorMessage component with error type detection (rate limit/not found/network)
- Retry button for transient errors
- Replaces generic red error box with proper Alert component

Signed-off-by: Ai-chan-0411 <ai-chan-0411@users.noreply.github.com>
@vercel
Copy link
Copy Markdown

vercel bot commented Apr 12, 2026

@Ai-chan-0411 is attempting to deploy a commit to the osama's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown

Thank you for the pull request! ✅

A maintainer will review this soon. Please be patient while we take a look. 🙌

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.

Display friendly error message on API failure

1 participant