mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-29 21:15:19 +00:00
rename to setUnrecoverableError and remove onLeave call because that will be handled by an effect.
This commit is contained in:
@@ -69,7 +69,7 @@ import {
|
|||||||
ElementCallError,
|
ElementCallError,
|
||||||
ErrorCategory,
|
ErrorCategory,
|
||||||
ErrorCode,
|
ErrorCode,
|
||||||
RTCSessionError
|
RTCSessionError,
|
||||||
} from "../utils/errors.ts";
|
} from "../utils/errors.ts";
|
||||||
import { ElementCallRichError } from "../RichError.tsx";
|
import { ElementCallRichError } from "../RichError.tsx";
|
||||||
import {
|
import {
|
||||||
@@ -139,13 +139,12 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
rtcSession,
|
rtcSession,
|
||||||
MatrixRTCSessionEvent.MembershipManagerError,
|
MatrixRTCSessionEvent.MembershipManagerError,
|
||||||
(error) => {
|
(error) => {
|
||||||
setEnterRTCError(
|
setUnrecoverableError(
|
||||||
new RTCSessionError(
|
new RTCSessionError(
|
||||||
ErrorCode.MEMBERSHIP_MANAGER_UNRECOVERABLE,
|
ErrorCode.MEMBERSHIP_MANAGER_UNRECOVERABLE,
|
||||||
error.message ?? error,
|
error.message ?? error,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
onLeave("error");
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -214,7 +213,7 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof ElementCallError) {
|
if (e instanceof ElementCallError) {
|
||||||
// e.code === ErrorCode.MISSING_LIVE_KIT_SERVICE_URL)
|
// e.code === ErrorCode.MISSING_LIVE_KIT_SERVICE_URL)
|
||||||
setEnterRTCError(e);
|
setUnrecoverableError(e);
|
||||||
} else {
|
} else {
|
||||||
logger.error(`Unknown Error while entering RTC session`, e);
|
logger.error(`Unknown Error while entering RTC session`, e);
|
||||||
const error = new ElementCallError(
|
const error = new ElementCallError(
|
||||||
@@ -222,7 +221,7 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
ErrorCode.UNKNOWN_ERROR,
|
ErrorCode.UNKNOWN_ERROR,
|
||||||
ErrorCategory.UNKNOWN,
|
ErrorCategory.UNKNOWN,
|
||||||
);
|
);
|
||||||
setEnterRTCError(error);
|
setUnrecoverableError(error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -322,9 +321,8 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
const [left, setLeft] = useState(false);
|
const [left, setLeft] = useState(false);
|
||||||
const [enterRTCError, setEnterRTCError] = useState<ElementCallError | null>(
|
const [unrecoverableError, setUnrecoverableError] =
|
||||||
null,
|
useState<ElementCallError | null>(null);
|
||||||
);
|
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const onLeave = useCallback(
|
const onLeave = useCallback(
|
||||||
@@ -495,11 +493,11 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
);
|
);
|
||||||
|
|
||||||
let body: ReactNode;
|
let body: ReactNode;
|
||||||
if (enterRTCError) {
|
if (unrecoverableError) {
|
||||||
// If an ElementCallError was recorded, then create a component that will fail to render and throw
|
// If an ElementCallError was recorded, then create a component that will fail to render and throw
|
||||||
// an ElementCallRichError error. This will then be handled by the ErrorBoundary component.
|
// an ElementCallRichError error. This will then be handled by the ErrorBoundary component.
|
||||||
const ErrorComponent = (): ReactNode => {
|
const ErrorComponent = (): ReactNode => {
|
||||||
throw new ElementCallRichError(enterRTCError);
|
throw new ElementCallRichError(unrecoverableError);
|
||||||
};
|
};
|
||||||
body = <ErrorComponent />;
|
body = <ErrorComponent />;
|
||||||
} else if (isJoined) {
|
} else if (isJoined) {
|
||||||
|
|||||||
Reference in New Issue
Block a user