♻️(frontend) prefer captureMediaEvent over reportError when no-op

Switch calls to `reportError` over to `captureMediaEvent` when the
underlying situation is not an engineering issue to investigate but
rather a media-related event worth tracking (e.g. no camera or
microphone available on the user's device).

`reportError` stays reserved for actual errors that warrant an
engineer's attention.
This commit is contained in:
lebaudantoine
2026-08-10 19:10:26 +02:00
committed by aleb_the_flash
parent 199c0297d4
commit ab40ec365d
3 changed files with 14 additions and 3 deletions
+1
View File
@@ -22,6 +22,7 @@ and this project adheres to
- ♻️(frontend) encapsulate PostHog capture calls in the telemetry module
- 🔧(frontend) sync persisted device ids with the actual selected devices
- 💄(frontend) hide the ProConnect button on narrow viewports
- ♻️(frontend) prefer captureMediaEvent over reportError when no-op
### Fixed
@@ -134,7 +134,8 @@ export const captureMediaEvent = async (
| 'media-acquisition'
| 'media-device-topology'
| 'media-device-success'
| 'device-not-found',
| 'device-not-found'
| 'permissions-denied',
props: Record<string, unknown>
) => {
captureEvent(event, { ...props, ...(await deviceSnapshot()) })
@@ -13,7 +13,7 @@ import {
notePermissionDeniedFromGum,
type PermissionKind,
} from '@/stores/permissions'
import { reportError } from '@/features/analytics/telemetry'
import { captureMediaEvent, reportError } from '@/features/analytics/telemetry'
import {
saveAudioInputDeviceId,
saveAudioInputEnabled,
@@ -39,12 +39,21 @@ const PERMISSION_KIND: Record<'audioinput' | 'videoinput', PermissionKind> = {
}
export const onJoinPreviewError = (e: Error, kind?: PermissionKind) => {
reportError('join_preview_failure', e, { path: 'join_preview', kind })
if (
MediaDeviceFailure.getFailure(e) === MediaDeviceFailure.PermissionDenied
) {
notePermissionDeniedFromGum(kind)
captureMediaEvent('permissions-denied', { path: 'join_preview', kind })
return
}
if (MediaDeviceFailure.getFailure(e) === MediaDeviceFailure.NotFound) {
captureMediaEvent('device-not-found', { path: 'join_preview', kind })
return
}
// "Other" and "Device in use" are still reported as errors, as they are not handled on the join screen.
reportError('join_preview_failure', e, { path: 'join_preview', kind })
}
// Module-level: effect dependencies, must be referentially stable.