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:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user