feat: error handling, logging, analytics, OG tags, and sticky sidebar #44

Merged
naomi merged 3 commits from feat/logger into main 2026-03-09 19:54:43 -07:00
Owner

Summary

  • Add comprehensive try/catch error handling across all API routes, middleware, and the Hono global error handler, piping every unhandled error to the @nhcarrigan/logger service to prevent silent crashes and unhandled Promise rejections
  • Add a logError utility on the frontend that forwards errors through the overridden console.error to the backend telemetry endpoint; apply it to every silent catch {} block in the game context, sound, notification, and clipboard utilities, and wrap the React tree in an ErrorBoundary
  • Add Plausible analytics, Open Graph + Twitter Card meta tags, Tree-Nation widget, and Google Ads to index.html
  • Make the game sidebar sticky with a --resource-bar-height CSS custom property offset so it stays viewport-height without overlapping the resource bar; reset sticky behaviour in the mobile responsive override

Test plan

  • Lint passes: pnpm lint
  • Build passes: pnpm build
  • Verify errors thrown in API routes appear in the logger service rather than crashing the process
  • Verify frontend errors appear in the /api/fe/error backend log
  • Verify Open Graph tags render correctly when sharing the URL
  • Verify Plausible analytics fires on page load
  • Verify Tree-Nation badge renders in the sidebar
  • Verify sidebar stays fixed while the main content scrolls on desktop
  • Verify mobile layout is unaffected

This issue was created with help from Hikari~ 🌸

## Summary - Add comprehensive try/catch error handling across all API routes, middleware, and the Hono global error handler, piping every unhandled error to the `@nhcarrigan/logger` service to prevent silent crashes and unhandled Promise rejections - Add a `logError` utility on the frontend that forwards errors through the overridden `console.error` to the backend telemetry endpoint; apply it to every silent `catch {}` block in the game context, sound, notification, and clipboard utilities, and wrap the React tree in an `ErrorBoundary` - Add Plausible analytics, Open Graph + Twitter Card meta tags, Tree-Nation widget, and Google Ads to `index.html` - Make the game sidebar sticky with a `--resource-bar-height` CSS custom property offset so it stays viewport-height without overlapping the resource bar; reset sticky behaviour in the mobile responsive override ## Test plan - [ ] Lint passes: `pnpm lint` - [ ] Build passes: `pnpm build` - [ ] Verify errors thrown in API routes appear in the logger service rather than crashing the process - [ ] Verify frontend errors appear in the `/api/fe/error` backend log - [ ] Verify Open Graph tags render correctly when sharing the URL - [ ] Verify Plausible analytics fires on page load - [ ] Verify Tree-Nation badge renders in the sidebar - [ ] Verify sidebar stays fixed while the main content scrolls on desktop - [ ] Verify mobile layout is unaffected ✨ This issue was created with help from Hikari~ 🌸
hikari added 2 commits 2026-03-09 19:22:19 -07:00
Wrap all async API route handlers and services in try/catch blocks,
piping errors to the @nhcarrigan/logger telemetry service. Add a
frontend logError utility, React ErrorBoundary, and overridden console
to forward all unhandled client-side errors to the backend telemetry
endpoint.
feat(web): add analytics, OG tags, Tree-Nation, ads, sticky sidebar
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m1s
CI / Lint, Build & Test (pull_request) Failing after 1m5s
2a0a3511b4
- Add Plausible analytics script to index.html
- Add Open Graph and Twitter Card meta tags using the CDN background image
- Add Tree-Nation widget loader, init script, and badge div in sidebar
- Add Google Ads script
- Make game sidebar sticky with --resource-bar-height offset (3.5rem)
- Reset sidebar sticky properties in mobile responsive override
hikari added 1 commit 2026-03-09 19:52:34 -07:00
test(api): achieve 100% coverage across all routes, middleware, and services
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 1m3s
CI / Lint, Build & Test (pull_request) Successful in 1m8s
d48b53eecd
- Add full test suite for frontend.ts (POST /log and POST /error)
- Add error-path tests to all route handlers to cover catch blocks
  triggered by Prisma rejections
- Add non-Error throw tests to cover the `new Error(String(error))`
  ternary false branch in middleware, services, and route catch handlers
- Suppress unreachable outer catch in about.ts with v8 ignore (fetchReleases
  swallows all errors internally, making the outer catch genuinely dead code)
naomi merged commit a36c8e72a5 into main 2026-03-09 19:54:43 -07:00
naomi deleted branch feat/logger 2026-03-09 19:54:43 -07:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: nhcarrigan/elysium#44