Feature/error boundary - #107
Open
yahia008 wants to merge 12 commits into
Open
Conversation
… clear all library warnings
… errors in frontend
- Split into parallel jobs: lint, typecheck, test, build - Add --forceExit --ci to jest to prevent CI hangs from open handles - Add --no-lint to next build (lint runs as separate dedicated job) - Add NEXT_TELEMETRY_DISABLED=1 to build step - Add workflow file itself to paths trigger - Add branches: [main, develop] to push trigger
.babelrc was forcing Next.js to use Babel instead of SWC, causing: - next/font incompatibility (requires SWC) - Babel failing to parse class private methods in Sentry/node deps Jest transforms already use ts-jest and babel-jest with configFile:false so .babelrc was not needed by tests.
- Wrap useSearchParams() in Suspense boundary on / and /leaderboard (required by Next.js 14 app router for static page generation) - Move router.push() in /create from render time into useEffect to avoid ReferenceError: location is not defined during SSR
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title
feat(frontend): implement issue #99 - Error Boundary and Sentry Monitoring
Closes #99
Description
This PR implements the Error Boundary & Monitoring system (Issue #99) to safeguard the application against React
component-level crashes, integrate automated error tracking using Sentry, classify errors, scrub sensitive user
information/credentials before logging, and present a premium user fallback UI.
Additionally, this PR fixes a few pre-existing syntax/compilation errors in the frontend workspace files to ensure
clean compilation.
Key Changes
• Integrated @sentry/nextjs into the React application workspace.
• Configured Sentry client, server, and edge configuration files ( sentry.client.config.ts , sentry.server.
config.ts , and sentry.edge.config.ts ).
• Hooked Sentry webpack compilation into next.config.js to enable source maps while hiding them from public
bundles in production.
• Created ErrorCategory ( USER , BUG , NETWORK , WALLET ) and AppError subclass supporting details and
user-facing notifications.
• Created logError utility in src/lib/error.ts to automatically assign scopes, categories, and report to
Sentry.
• Implemented sanitizeString and sanitizeObject utility functions to automatically filter sensitive fields
from messages, stack traces, and contexts before reaching Sentry.
• Specifically filters out Stellar secret keys (56-char uppercase keys starting with S ), 64-character hex
keys/private keys, email addresses, JWT tokens, and sensitive request headers ( authorization , cookie , set-
cookie , x-api-key ).
• Redesigned ErrorBoundary component to capture rendering crashes and show a responsive glassmorphic card
with ambient background glows, warning icons, a sanitized error code block, and buttons to reload ("Try again")
or navigate home.
• Redesigned Next.js global route error.tsx page to log crashes automatically and render matching premium
glassmorphic actions.
• Corrected a duplicate code block and missing closing bracket in the governance/[id]/page.tsx page.
• Resolved a TypeScript JSX compiler error in useLeaderboard.test.ts (a .ts file containing JSX code) by
converting the wrapper implementation to use React.createElement .
──────
Technical Specs & Testing
Wrote 14 comprehensive unit tests in two suites matching /src/components/ui/tests :
• ErrorBoundary.test.tsx : Verifies crash catching, logging to Sentry handler, fallback rendering, reload button
click handler, and navigation.
• error.test.ts : Verifies full regex redacting/scrubbing for Stellar secrets, hex keys, emails, JWT tokens, and
nested objects, as well as verifying correct Sentry logging scope tag mapping.
Test Run Results:
Checklist
[✓] Error boundaries catch all component errors
[✓] Sentry SDK integrated on client, server, and edge runtimes
[✓] Stack traces captured safely with source maps configured
[✓] Sensitive user data (Stellar private seeds, hex keys, JWTs, emails) filtered from logs
[✓] Users shown responsive glassmorphism warning card
[✓] Comprehensive unit tests passing for boundaries and sanitization utilities***
───────────────────────────────────────────────