function _conferenceFailed()

in react/features/base/conference/middleware.any.js [118:183]


function _conferenceFailed({ dispatch, getState }, next, action) {
    const result = next(action);
    const { conference, error } = action;
    const { enableForcedReload } = getState()['features/base/config'];

    // Handle specific failure reasons.
    switch (error.name) {
    case JitsiConferenceErrors.CONFERENCE_DESTROYED: {
        const [ reason ] = error.params;

        dispatch(showErrorNotification({
            description: reason,
            titleKey: 'dialog.sessTerminated'
        }, NOTIFICATION_TIMEOUT_TYPE.LONG));

        break;
    }
    case JitsiConferenceErrors.CONFERENCE_RESTARTED: {
        if (enableForcedReload) {
            dispatch(showErrorNotification({
                description: 'Restart initiated because of a bridge failure',
                titleKey: 'dialog.sessionRestarted'
            }, NOTIFICATION_TIMEOUT_TYPE.LONG));
        }

        break;
    }
    case JitsiConferenceErrors.CONNECTION_ERROR: {
        const [ msg ] = error.params;

        dispatch(connectionDisconnected(getState()['features/base/connection'].connection));
        dispatch(showErrorNotification({
            descriptionArguments: { msg },
            descriptionKey: msg ? 'dialog.connectErrorWithMsg' : 'dialog.connectError',
            titleKey: 'connection.CONNFAIL'
        }, NOTIFICATION_TIMEOUT_TYPE.LONG));

        break;
    }
    case JitsiConferenceErrors.OFFER_ANSWER_FAILED:
        sendAnalytics(createOfferAnswerFailedEvent());
        break;
    }

    if (typeof APP === 'undefined') {
        !error.recoverable
        && conference
        && conference.leave().catch(reason => {
            // Even though we don't care too much about the failure, it may be
            // good to know that it happen, so log it (on the info level).
            logger.info('JitsiConference.leave() rejected with:', reason);
        });
    } else {
        // FIXME: Workaround for the web version. Currently, the creation of the
        // conference is handled by /conference.js and appropriate failure handlers
        // are set there.
        _removeUnloadHandler(getState);
    }

    if (enableForcedReload && error?.name === JitsiConferenceErrors.CONFERENCE_RESTARTED) {
        dispatch(conferenceWillLeave(conference));
        dispatch(reloadNow());
    }

    return result;
}