fix(audio): handle NotAllowedError in skipCheck:true scenarios
In scenarios where the join audio flow skips echo test, NotAllowedError (and any other errors) are all being mashed together under a generic MEDIA_ERROR object. Properly handle specific errors in audio-manager so they're correctly render in the audio modal help screen.
This commit is contained in:
parent
501d627392
commit
68f66a1fbb
@ -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,
|
||||
});
|
||||
};
|
||||
|
@ -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 };
|
||||
|
@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user