mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-31 20:58:03 +00:00
48c0cb320e
Introduce a telemetry module that exposes a `reportError` helper. Under the hood it forwards errors to PostHog, but the module is the only place that knows about PostHog. Replace `console.error` calls used for error reporting with `reportError`, so the codebase now goes through a single, consistent API for telemetry. This normalizes how errors are reported and makes it straightforward to swap PostHog for another backend later on, without touching every call site.
25 lines
777 B
TypeScript
25 lines
777 B
TypeScript
import type { Participant } from 'livekit-client'
|
|
import { useMuteParticipant } from './muteParticipant'
|
|
import { reportError } from '@/features/analytics/telemetry'
|
|
|
|
export const useMuteParticipants = () => {
|
|
const { muteParticipant } = useMuteParticipant()
|
|
|
|
const muteParticipants = (participants: Array<Participant>) => {
|
|
try {
|
|
const promises = participants.map((participant) =>
|
|
muteParticipant(participant)
|
|
)
|
|
return Promise.all(promises)
|
|
} catch (error) {
|
|
reportError('participant_mute_api_failure', error, {
|
|
context: 'An error occurred while muting participants :',
|
|
})
|
|
throw new Error('An error occurred while muting participants.', {
|
|
cause: error,
|
|
})
|
|
}
|
|
}
|
|
return { muteParticipants }
|
|
}
|