mirror of
https://github.com/suitenumerique/meet.git
synced 2026-08-21 23:57:00 +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
794 B
TypeScript
25 lines
794 B
TypeScript
import type { Participant } from 'livekit-client'
|
|
import { useLowerHandParticipant } from './lowerHandParticipant'
|
|
import { reportError } from '@/features/analytics/telemetry'
|
|
|
|
export const useLowerHandParticipants = () => {
|
|
const { lowerHandParticipant } = useLowerHandParticipant()
|
|
|
|
const lowerHandParticipants = (participants: Array<Participant>) => {
|
|
try {
|
|
const promises = participants.map((participant) =>
|
|
lowerHandParticipant(participant)
|
|
)
|
|
return Promise.all(promises)
|
|
} catch (error) {
|
|
reportError('generic_failure', error, {
|
|
context: 'An error occurred while lowering hands :',
|
|
})
|
|
throw new Error('An error occurred while lowering hands.', {
|
|
cause: error,
|
|
})
|
|
}
|
|
}
|
|
return { lowerHandParticipants }
|
|
}
|