Error Handling: gracefully handle missing livekit service url in config

This commit is contained in:
Valere
2025-02-26 14:55:03 +01:00
parent 7423dfa527
commit 3c23e5a4e6
5 changed files with 125 additions and 14 deletions

View File

@@ -8,16 +8,17 @@ Please see LICENSE in the repository root for full details.
import { type MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession";
import { logger } from "matrix-js-sdk/src/logger";
import {
type LivekitFocus,
type LivekitFocusActive,
isLivekitFocus,
isLivekitFocusConfig,
type LivekitFocus,
type LivekitFocusActive,
} from "matrix-js-sdk/src/matrixrtc/LivekitFocus";
import { AutoDiscovery } from "matrix-js-sdk/src/autodiscovery";
import { PosthogAnalytics } from "./analytics/PosthogAnalytics";
import { Config } from "./config/Config";
import { ElementWidgetActions, type WidgetHelpers, widget } from "./widget";
import { ElementWidgetActions, widget, type WidgetHelpers } from "./widget";
import { ElementCallError, ErrorCode } from "./utils/ec-errors.ts";
const FOCI_WK_KEY = "org.matrix.msc4143.rtc_foci";
@@ -80,9 +81,10 @@ async function makePreferredLivekitFoci(
}
if (preferredFoci.length === 0)
throw new Error(
throw new ElementCallError(
`No livekit_service_url is configured so we could not create a focus.
Currently we skip computing a focus based on other users in the room.`,
ErrorCode.MISSING_LIVE_KIT_SERVICE_URL,
);
return Promise.resolve(preferredFoci);