From 1fbf8e268622733b6569430859d16d924fee4759 Mon Sep 17 00:00:00 2001 From: Valere Date: Fri, 28 Feb 2025 12:17:28 +0100 Subject: [PATCH] review: Report unknown exceptions when entering RTC session --- src/room/GroupCallView.tsx | 13 ++++++++++++- src/utils/errors.ts | 5 +++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/room/GroupCallView.tsx b/src/room/GroupCallView.tsx index 48238c0a..34ed49de 100644 --- a/src/room/GroupCallView.tsx +++ b/src/room/GroupCallView.tsx @@ -61,7 +61,12 @@ import { callEventAudioSounds } from "./CallEventAudioRenderer"; import { useLatest } from "../useLatest"; import { usePageTitle } from "../usePageTitle"; import { ErrorView } from "../ErrorView"; -import { ConnectionLostError, ElementCallError } from "../utils/errors.ts"; +import { + ConnectionLostError, + ElementCallError, + ErrorCategory, + ErrorCode, +} from "../utils/errors.ts"; import { ElementCallRichError } from "../RichError.tsx"; declare global { @@ -179,6 +184,12 @@ export const GroupCallView: FC = ({ setEnterRTCError(e); } else { logger.error(`Unknown Error while entering RTC session`, e); + const error = new ElementCallError( + e.message, + ErrorCode.UNKNOWN_ERROR, + ErrorCategory.UNKNOWN, + ); + setEnterRTCError(error); } } }; diff --git a/src/utils/errors.ts b/src/utils/errors.ts index 14436977..c87bdee7 100644 --- a/src/utils/errors.ts +++ b/src/utils/errors.ts @@ -13,13 +13,14 @@ export enum ErrorCode { */ MISSING_MATRIX_RTC_FOCUS = "MISSING_MATRIX_RTC_FOCUS", CONNECTION_LOST_ERROR = "CONNECTION_LOST_ERROR", - // UNKNOWN_ERROR = "UNKNOWN_ERROR", + UNKNOWN_ERROR = "UNKNOWN_ERROR", } export enum ErrorCategory { /** Calling is not supported, server misconfigured (JWT service missing, no MSC support ...)*/ CONFIGURATION_ISSUE = "CONFIGURATION_ISSUE", NETWORK_CONNECTIVITY = "NETWORK_CONNECTIVITY", + UNKNOWN = "UNKNOWN", // SYSTEM_FAILURE / FEDERATION_FAILURE .. } @@ -37,7 +38,7 @@ export class ElementCallError extends Error { category: ErrorCategory, localisedMessage?: string, ) { - super(); + super(name); this.localisedMessage = localisedMessage; this.category = category; this.code = code;