Skip to content

Commit 1fbf8e2

Browse files
committed
review: Report unknown exceptions when entering RTC session
1 parent 2b35573 commit 1fbf8e2

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/room/GroupCallView.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ import { callEventAudioSounds } from "./CallEventAudioRenderer";
6161
import { useLatest } from "../useLatest";
6262
import { usePageTitle } from "../usePageTitle";
6363
import { ErrorView } from "../ErrorView";
64-
import { ConnectionLostError, ElementCallError } from "../utils/errors.ts";
64+
import {
65+
ConnectionLostError,
66+
ElementCallError,
67+
ErrorCategory,
68+
ErrorCode,
69+
} from "../utils/errors.ts";
6570
import { ElementCallRichError } from "../RichError.tsx";
6671

6772
declare global {
@@ -179,6 +184,12 @@ export const GroupCallView: FC<Props> = ({
179184
setEnterRTCError(e);
180185
} else {
181186
logger.error(`Unknown Error while entering RTC session`, e);
187+
const error = new ElementCallError(
188+
e.message,
189+
ErrorCode.UNKNOWN_ERROR,
190+
ErrorCategory.UNKNOWN,
191+
);
192+
setEnterRTCError(error);
182193
}
183194
}
184195
};

src/utils/errors.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@ export enum ErrorCode {
1313
*/
1414
MISSING_MATRIX_RTC_FOCUS = "MISSING_MATRIX_RTC_FOCUS",
1515
CONNECTION_LOST_ERROR = "CONNECTION_LOST_ERROR",
16-
// UNKNOWN_ERROR = "UNKNOWN_ERROR",
16+
UNKNOWN_ERROR = "UNKNOWN_ERROR",
1717
}
1818

1919
export enum ErrorCategory {
2020
/** Calling is not supported, server misconfigured (JWT service missing, no MSC support ...)*/
2121
CONFIGURATION_ISSUE = "CONFIGURATION_ISSUE",
2222
NETWORK_CONNECTIVITY = "NETWORK_CONNECTIVITY",
23+
UNKNOWN = "UNKNOWN",
2324
// SYSTEM_FAILURE / FEDERATION_FAILURE ..
2425
}
2526

@@ -37,7 +38,7 @@ export class ElementCallError extends Error {
3738
category: ErrorCategory,
3839
localisedMessage?: string,
3940
) {
40-
super();
41+
super(name);
4142
this.localisedMessage = localisedMessage;
4243
this.category = category;
4344
this.code = code;

0 commit comments

Comments
 (0)