Skip to content

Conversation

@marcodejongh
Copy link
Owner

Summary

Added comprehensive error handling to all board-related route pages and layouts by wrapping server-side logic in try-catch blocks and calling notFound() when errors occur. This ensures graceful error handling instead of unhandled promise rejections.

Key Changes

  • Create climb page (create/page.tsx): Wrapped route parameter parsing and board initialization in try-catch, calls notFound() on error
  • Import page (import/page.tsx): Added error handling around MoonBoard import logic with notFound() fallback
  • Board layout (layout.tsx): Wrapped board details fetching and parameter parsing with error handling
  • List layout (list/layout.tsx): Added try-catch around board details initialization
  • List page (list/page.tsx): Wrapped climb search and board details fetching with error handling
  • Play page (play/[climb_uuid]/page.tsx): Added error handling for climb fetching and board initialization
  • Play layout (play/layout.tsx): Wrapped board details fetching with error handling

Implementation Details

  • All changes follow the same pattern: wrap the entire async function body in a try-catch block
  • Errors are logged to console with descriptive messages indicating which page encountered the error
  • notFound() from next/navigation is called in catch blocks to return a 404 response
  • This prevents unhandled promise rejections and provides better user experience with proper HTTP status codes
  • No changes to the core business logic, only error handling wrapper added

…rror

When users access URLs with invalid slug parameters (e.g., non-existent
sizes or layouts), the parseBoardRouteParamsWithSlugs function throws an
error. Previously this caused a 500 Server Components render error.

This change wraps the main function bodies of affected pages and layouts
in try-catch blocks, catching parsing errors and returning a proper 404
page via Next.js notFound() instead of propagating the error.

Affected files:
- list/page.tsx, list/layout.tsx
- layout.tsx (angle layout)
- play/[climb_uuid]/page.tsx, play/layout.tsx
- create/page.tsx
- import/page.tsx

Fixes Sentry issue BOARDSESH-4
@vercel
Copy link

vercel bot commented Jan 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
boardsesh Building Building Preview, Comment Jan 24, 2026 0:28am

Request Review

@claude
Copy link

claude bot commented Jan 24, 2026

Claude Review

Ready to merge - Minor issues noted below, but nothing blocking.

Issues

  1. Swallowed errors lose debugging context (all files): The generic catch (error) { console.error(...); notFound(); } pattern converts all errors (including programming bugs, config issues, network timeouts) into 404s. Consider:

    • Only catching expected errors (e.g., invalid params, missing data)
    • Re-throwing unexpected errors to maintain proper error reporting
    • At minimum, preserving error type information in logs (currently logs then discards)
  2. Inconsistent error handling in list/page.tsx: The file previously had a targeted try-catch around only the data fetching (Promise.all). The new version wraps everything including param parsing in the same catch block, which now returns 404 for any error rather than just data fetching failures.

  3. No tests for error handling behavior: The PR adds error handling to 7 route files but includes no tests verifying:

    • That notFound() is called for invalid params
    • That valid requests still work correctly
    • Edge cases like partial failures

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.

3 participants