add error screen

This commit is contained in:
Timo
2025-02-28 11:51:10 +01:00
parent 141d02a4fd
commit 34dae752ee
2 changed files with 24 additions and 2 deletions

View File

@@ -69,6 +69,7 @@ import {
ElementCallError, ElementCallError,
ErrorCategory, ErrorCategory,
ErrorCode, ErrorCode,
RTCSessionError
} from "../utils/errors.ts"; } from "../utils/errors.ts";
import { ElementCallRichError } from "../RichError.tsx"; import { ElementCallRichError } from "../RichError.tsx";
import { import {
@@ -137,8 +138,15 @@ export const GroupCallView: FC<Props> = ({
useTypedEventEmitter( useTypedEventEmitter(
rtcSession, rtcSession,
MatrixRTCSessionEvent.MembershipManagerError, MatrixRTCSessionEvent.MembershipManagerError,
// TODO: make this set the error state so that we can render an error page. (error) => {
(error) => logger.error(error), setEnterRTCError(
new RTCSessionError(
ErrorCode.MEMBERSHIP_MANAGER_UNRECOVERABLE,
error.message ?? error,
),
);
onLeave("error");
},
); );
useEffect(() => { useEffect(() => {
// Sanity check the room object // Sanity check the room object

View File

@@ -13,13 +13,16 @@ export enum ErrorCode {
*/ */
MISSING_MATRIX_RTC_FOCUS = "MISSING_MATRIX_RTC_FOCUS", MISSING_MATRIX_RTC_FOCUS = "MISSING_MATRIX_RTC_FOCUS",
CONNECTION_LOST_ERROR = "CONNECTION_LOST_ERROR", CONNECTION_LOST_ERROR = "CONNECTION_LOST_ERROR",
MEMBERSHIP_MANAGER_UNRECOVERABLE = "MEMBERSHIP_MANAGER_UNRECOVERABLE",
UNKNOWN_ERROR = "UNKNOWN_ERROR", UNKNOWN_ERROR = "UNKNOWN_ERROR",
// UNKNOWN_ERROR = "UNKNOWN_ERROR",
} }
export enum ErrorCategory { export enum ErrorCategory {
/** Calling is not supported, server misconfigured (JWT service missing, no MSC support ...)*/ /** Calling is not supported, server misconfigured (JWT service missing, no MSC support ...)*/
CONFIGURATION_ISSUE = "CONFIGURATION_ISSUE", CONFIGURATION_ISSUE = "CONFIGURATION_ISSUE",
NETWORK_CONNECTIVITY = "NETWORK_CONNECTIVITY", NETWORK_CONNECTIVITY = "NETWORK_CONNECTIVITY",
RTC_SESSION_FAILIOUR = "RTC_SESSION_FAILIOUR",
UNKNOWN = "UNKNOWN", UNKNOWN = "UNKNOWN",
// SYSTEM_FAILURE / FEDERATION_FAILURE .. // SYSTEM_FAILURE / FEDERATION_FAILURE ..
} }
@@ -72,3 +75,14 @@ export class ConnectionLostError extends ElementCallError {
); );
} }
} }
export class RTCSessionError extends ElementCallError {
public constructor(code: ErrorCode, message: string) {
super(
"RTCSession Error",
code,
ErrorCategory.RTC_SESSION_FAILIOUR,
message,
);
}
}