diff --git a/bigbluebutton-html5/imports/ui/components/audio/audio-modal/component.jsx b/bigbluebutton-html5/imports/ui/components/audio/audio-modal/component.jsx index 8afc079537..7f89d61442 100755 --- a/bigbluebutton-html5/imports/ui/components/audio/audio-modal/component.jsx +++ b/bigbluebutton-html5/imports/ui/components/audio/audio-modal/component.jsx @@ -359,20 +359,21 @@ class AudioModal extends Component { } handleJoinMicrophoneError(err) { - const { type } = err; + const { type, errCode, errMessage } = err; + switch (type) { case 'MEDIA_ERROR': this.setState({ content: 'help', - errCode: 0, - errMessage: type, + errCode, + errMessage, disableActions: false, }); break; case 'CONNECTION_ERROR': default: this.setState({ - errCode: 0, + errCode, errMessage: type, disableActions: false, }); @@ -533,7 +534,7 @@ class AudioModal extends Component { this.setState({ content: 'help', errCode, - errMessage: error?.name || 'GUMFailure', + errMessage: error?.name || 'NotAllowedError', disableActions: false, }); }; diff --git a/bigbluebutton-html5/imports/ui/services/audio-manager/error-codes.js b/bigbluebutton-html5/imports/ui/services/audio-manager/error-codes.js index 7e8fede881..1c4bdbad08 100644 --- a/bigbluebutton-html5/imports/ui/services/audio-manager/error-codes.js +++ b/bigbluebutton-html5/imports/ui/services/audio-manager/error-codes.js @@ -1,7 +1,9 @@ const MIC_ERROR = { + UNKNOWN: 0, NO_SSL: 9, MAC_OS_BLOCK: 8, NO_PERMISSION: 7, + DEVICE_NOT_FOUND: 6, }; export default { MIC_ERROR }; diff --git a/bigbluebutton-html5/imports/ui/services/audio-manager/index.js b/bigbluebutton-html5/imports/ui/services/audio-manager/index.js index e712f26438..66a1aad8f2 100755 --- a/bigbluebutton-html5/imports/ui/services/audio-manager/index.js +++ b/bigbluebutton-html5/imports/ui/services/audio-manager/index.js @@ -333,14 +333,16 @@ class AudioManager { return this.bridge .joinAudio(callOptions, callStateCallback.bind(this)) .catch((error) => { - const { name } = error; - - if (!name) { - throw error; - } + const { name, message } = error; + const errorPayload = { + type: 'MEDIA_ERROR', + errMessage: message || 'MEDIA_ERROR', + errCode: AudioErrors.MIC_ERROR.UNKNOWN, + }; switch (name) { case 'NotAllowedError': + errorPayload.errCode = AudioErrors.MIC_ERROR.NO_PERMISSION; logger.error( { logCode: 'audiomanager_error_getting_device', @@ -353,6 +355,7 @@ class AudioManager { ); break; case 'NotFoundError': + errorPayload.errCode = AudioErrors.MIC_ERROR.DEVICE_NOT_FOUND; logger.error( { logCode: 'audiomanager_error_device_not_found', @@ -364,17 +367,21 @@ class AudioManager { `Error getting microphone - {${error.name}: ${error.message}}` ); break; - default: + logger.error({ + logCode: 'audiomanager_error_unknown', + extraInfo: { + errorName: error.name, + errorMessage: error.message, + }, + }, `Error getting microphone - {${name}: ${message}}`); break; } this.isConnecting = false; this.isWaitingPermissions = false; - throw { - type: 'MEDIA_ERROR', - }; + throw errorPayload; }); }