Surface errors via alert (#341)

This commit is contained in:
lukasIO 2024-09-26 18:02:29 +02:00 committed by GitHub
parent dbab065056
commit 398b172400
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -156,6 +156,16 @@ function VideoConferenceComponent(props: {
const router = useRouter();
const handleOnLeave = React.useCallback(() => router.push('/'), [router]);
const handleError = React.useCallback((error: Error) => {
console.error(error);
alert(`Encountered an unexpected error, check the console logs for details: ${error.message}`);
}, []);
const handleEncryptionError = React.useCallback((error: Error) => {
console.error(error);
alert(
`Encountered an unexpected encryption error, check the console logs for details: ${error.message}`,
);
}, []);
return (
<>
@ -167,6 +177,8 @@ function VideoConferenceComponent(props: {
video={props.userChoices.videoEnabled}
audio={props.userChoices.audioEnabled}
onDisconnected={handleOnLeave}
onEncryptionError={handleEncryptionError}
onError={handleError}
>
<VideoConference
chatMessageFormatter={formatChatMessageLinks}