From 398b1724009ee6f5eb318cafb2b0264ff5865e5a Mon Sep 17 00:00:00 2001 From: lukasIO Date: Thu, 26 Sep 2024 18:02:29 +0200 Subject: [PATCH] Surface errors via alert (#341) --- app/rooms/[roomName]/PageClientImpl.tsx | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/app/rooms/[roomName]/PageClientImpl.tsx b/app/rooms/[roomName]/PageClientImpl.tsx index 1bf4761..43f9668 100644 --- a/app/rooms/[roomName]/PageClientImpl.tsx +++ b/app/rooms/[roomName]/PageClientImpl.tsx @@ -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} >