-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix uncaught error when canceling screen sharing after joining a meeting #15466
base: master
Are you sure you want to change the base?
Fix uncaught error when canceling screen sharing after joining a meeting #15466
Conversation
Hi, thanks for your contribution! |
@@ -157,9 +157,14 @@ async function _toggleScreenSharing( | |||
try { | |||
tracks = await createLocalTracksF(options) as any[]; | |||
} catch (error) { | |||
dispatch(handleScreenSharingError(error, NOTIFICATION_TIMEOUT_TYPE.MEDIUM)); | |||
if (error.name) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this check?
this check was soly introduced to check the error related to user-cancelled errors.
Perhaps this could be improved with error.name ="gum.screensharing_user_canceled". I hope this would make more sense.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As soon as we are getting the error we are returning. I think it does the job well , what do u think about that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to check the logic on the calling side. As in, the caller of this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to check the logic on the calling side. As in, the caller of this function.
After going through the codebase , I find that ShareScreenWarningDialog component is responsible for handling the logic when the user chooses to stop sharing a screen or audio. The toggleScreensharing action is dispatched when the user submits the dialog. However , The dialog differentiates between audio-only and normal screen sharing modes using the _isAudioScreenShareWarning prop . If _isAudioScreenShareWarning is true, it handles the stop of audio screen sharing. Otherwise, it handles normal screen sharing.
If toggleScreensharing encounters an error due to user cancellation, it might not properly handle it, leading to unhandled promise rejections.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good find! Then I reckon we need to fix it there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@saghul I think the best practice is to handle this error in the toggleScreenSharing function itself rather than in the component because , The toggleScreenSharing function is responsible for managing the entire logic related to starting, stopping, and handling the state of screen sharing, including audio-only sharing and by handling the error inside this function, we centralize the error management for screen sharing. This means that any error or cancellation related to screen sharing is processed in a single location rather than in various places across the component hierarchy
With this change the uncaught error of screen share will be resolved.
Issue Resolve via this pr: #15456