Problem
Multiple client-side data fetchers swallow errors with catch {} or catch { /* non-critical */ }, leaving the UI in ambiguous states (spinner stops, but nothing renders; or no error message is ever shown).
Known locations (non-exhaustive):
src/pages/challenges/index.tsx:86-97 — fetchRecommended() and fetchHistory() have empty catches. On failure, loading stops but no error is surfaced.
src/pages/challenges/index.tsx:189-206 (approx) — submit and hint handlers swallow errors.
Expected behavior
Every network failure either:
- Triggers a user-visible toast/alert with a retry button, or
- Sets an
error state that the component renders (with a retry affordance).
And in all cases, the error is logged to the console and Sentry / equivalent monitoring.
Acceptance criteria
Suggested approach
Centralize:
export function handleClientError(err: unknown, opts: { context: string; toast?: boolean }) {
console.error(`[${opts.context}]`, err);
// TODO: Sentry.captureException(err)
if (opts.toast) toast.error("Something went wrong. Please try again.");
}
And replace each catch {} with catch (err) { handleClientError(err, { context: "fetchRecommended", toast: true }); }.
Problem
Multiple client-side data fetchers swallow errors with
catch {}orcatch { /* non-critical */ }, leaving the UI in ambiguous states (spinner stops, but nothing renders; or no error message is ever shown).Known locations (non-exhaustive):
src/pages/challenges/index.tsx:86-97—fetchRecommended()andfetchHistory()have empty catches. On failure, loading stops but no error is surfaced.src/pages/challenges/index.tsx:189-206(approx) — submit and hint handlers swallow errors.Expected behavior
Every network failure either:
errorstate that the component renders (with a retry affordance).And in all cases, the error is logged to the console and Sentry / equivalent monitoring.
Acceptance criteria
catch {},catch {\n},catch.*{\s*\/\/— fix every instance in client-side handlers.useFetchWithToasthook orhandleClientError(err, { toast: true })helper) to avoid per-site inconsistency..then/.catch.Suggested approach
Centralize:
And replace each
catch {}withcatch (err) { handleClientError(err, { context: "fetchRecommended", toast: true }); }.