refactor(errors): route silent catches through logError/reportError

Every catch now either surfaces, re-throws, or calls logError with a scope
tag. No more empty catches or bare console.error:

- auth-store: signInToFirebase / restoreSession / signOut paths gain
  logError context. Behavior is unchanged (best-effort local sign-out,
  fall back to login on restore failure).
- use-stream-autoplay: Audio.play() and download-URL fetches log their
  failures instead of dropping silently (both are nice-to-haves so UX
  stays silent — but we can now trace "why didn't autoplay trigger?").
- pusher-client: ws errors / parse failures / server errors / listener
  crashes all routed through logError, and listener bugs (which silently
  break user flows) now go through reportError so they're actually
  surfaced in observability.
- settings-page: email-notifications toggle now toasts on failure
  instead of silently reverting with no explanation.
- huddle-app: screen-share failures use logError.
This commit is contained in:
Claude
2026-04-17 02:55:23 +00:00
parent 8632c98725
commit 795bdfc286
5 changed files with 40 additions and 20 deletions
+9 -4
View File
@@ -5,6 +5,7 @@ import { apiClient } from "@/api/client";
import { useAuthStore } from "@/stores/auth-store";
import { useAutoplayStore } from "@/stores/autoplay-store";
import { resolveHumanDisplay } from "@/lib/humans";
import { logError } from "@/lib/errors";
/**
* Triggers autoplay when a stream's latest child changes to a new media particle.
@@ -37,7 +38,11 @@ export function useStreamAutoplay(
if (useAutoplayStore.getState().muted) return;
if (latestChild.type === "text") {
new Audio(beepSound).play().catch(() => {});
// Browser autoplay policy can block this before user interaction; that's
// fine — the beep is a nice-to-have, not a critical signal.
new Audio(beepSound).play().catch((err) =>
logError(err, { scope: "autoplay.beep" }),
);
return;
}
@@ -60,8 +65,8 @@ export function useStreamAutoplay(
senderName: displayName,
senderInitials: initials,
});
}).catch(() => {
// Failed to get download URL — skip autoplay silently
});
}).catch((err) =>
logError(err, { scope: "autoplay.fetchUrl", particleId: particle.id }),
);
}, [latestChild?.id]); // eslint-disable-line react-hooks/exhaustive-deps
}