screenshare: cleanup actions-bar onFailure callback

This commit is contained in:
prlanzarin 2020-12-15 17:45:57 +00:00
parent 569ace358b
commit c247bf46e7

View File

@ -138,29 +138,20 @@ const ScreenshareButton = ({
}) => { }) => {
// This is the failure callback that will be passed to the /api/screenshare/kurento.js // This is the failure callback that will be passed to the /api/screenshare/kurento.js
// script on the presenter's call // script on the presenter's call
const onFail = (normalizedError) => { const onFail = (error) => {
const { errorCode, errorMessage, errorReason } = normalizedError; const { errorCode, errorMessage, errorReason } = error;
const error = errorCode || errorMessage || errorReason; const errorLocale = errorCode || errorMessage || errorReason;
// We have a properly mapped error for this. Exit screenshare and show a toast notification logger.error({
if (intlMessages[error]) { logCode: 'screenshare_failed',
screenshareHasEnded(); extraInfo: { errorCode, errorMessage, errorReason },
notify(intl.formatMessage(intlMessages[error]), 'error', 'desktop'); }, 'Screenshare failed');
} else {
// Unmapped error. Log it (so we can infer what's going on), close screenSharing const localizedError = intlMessages[error] || intlMessages.genericError;
// session and display generic error message notify(intl.formatMessage(localizedError), 'error', 'desktop');
logger.error({ screenshareHasEnded();
logCode: 'screenshare_default_error',
extraInfo: {
errorCode, errorMessage, errorReason,
},
}, 'Default error handler for screenshare');
screenshareHasEnded();
notify(intl.formatMessage(intlMessages.genericError), 'error', 'desktop');
}
// Don't trigger the screen share end alert if presenter click to cancel on screen share dialog // Don't trigger the screen share end alert if presenter click to cancel on screen share dialog
if (error !== 'NotAllowedError') { if (error !== 'NotAllowedError') screenShareEndAlert();
screenShareEndAlert();
}
}; };
const renderScreenshareUnavailableModal = () => { const renderScreenshareUnavailableModal = () => {