Enhancement: Avoid console.error on 404 route — avoid spamming client logs #2

Closed
opened 2026-06-17 13:56:35 +00:00 by abumahid · 0 comments
Owner

Description

The NotFound component currently logs a console.error whenever a user lands on a 404 route.

Impact

  • Pollutes browser/client logs.
  • May create noise in error monitoring tools.
  • Can trigger unnecessary alerts in observability platforms.
  • Makes it harder to identify real application errors.

Location

src/pages/NotFound.tsx (useEffect, around lines ~7–9)

Suggested Fix

  • Remove the console.error statement.

  • If tracking 404 events is required:

    • Send telemetry to the application's analytics/logging service.
    • Only log in development mode.
    • Gate logging behind a feature flag.

Example

if (import.meta.env.DEV) {
  console.warn(`404 Route: ${location.pathname}`);
}

Acceptance Criteria

  • Remove the console.error from the NotFound component.
  • No unnecessary console.error calls remain in production-facing code.
  • Any required logging is gated behind a development check or feature flag.
  • 404 page behavior remains unchanged.
  • No new ESLint warnings or errors are introduced.

Local Verification

Run the following commands before creating the PR.

Build

npm run build

Lint Check

npm run lint

## Description The `NotFound` component currently logs a `console.error` whenever a user lands on a 404 route. ## Impact * Pollutes browser/client logs. * May create noise in error monitoring tools. * Can trigger unnecessary alerts in observability platforms. * Makes it harder to identify real application errors. ## Location `src/pages/NotFound.tsx` (`useEffect`, around lines ~7–9) ## Suggested Fix * Remove the `console.error` statement. * If tracking 404 events is required: * Send telemetry to the application's analytics/logging service. * Only log in development mode. * Gate logging behind a feature flag. ### Example ```ts if (import.meta.env.DEV) { console.warn(`404 Route: ${location.pathname}`); } ``` ## Acceptance Criteria * [ ] Remove the `console.error` from the `NotFound` component. * [ ] No unnecessary `console.error` calls remain in production-facing code. * [ ] Any required logging is gated behind a development check or feature flag. * [ ] 404 page behavior remains unchanged. * [ ] No new ESLint warnings or errors are introduced. --- ## Local Verification Run the following commands before creating the PR. ### Build ```bash npm run build ``` ### Lint Check ```bash npm run lint ``` ---
abumahid added the Kind/Enhancement label 2026-06-17 13:56:35 +00:00
abumahid added this to the techzaa-frontend project 2026-06-17 13:56:35 +00:00
abumahid moved this to Done in techzaa-frontend on 2026-06-17 16:22:31 +00:00
rimi closed this issue 2026-06-17 16:25:27 +00:00
Sign in to join this conversation.