CONFERENCE_FAILED error as object

This commit is contained in:
Lyubo Marinov 2017-10-05 07:41:35 -05:00
parent 3d32c2de89
commit c98e7a204c
6 changed files with 24 additions and 9 deletions

View File

@ -75,7 +75,8 @@ MiddlewareRegistry.register(store => next => action => {
}
case CONFERENCE_FAILED:
if (action.error === JitsiConferenceErrors.AUTHENTICATION_REQUIRED) {
if (action.error.name
=== JitsiConferenceErrors.AUTHENTICATION_REQUIRED) {
store.dispatch(waitForOwner());
} else {
store.dispatch(stopWaitForOwner());

View File

@ -4,7 +4,7 @@
* {
* type: CONFERENCE_FAILED,
* conference: JitsiConference,
* error: string
* error: Error
* }
*/
export const CONFERENCE_FAILED = Symbol('CONFERENCE_FAILED');

View File

@ -159,7 +159,7 @@ function _setLocalParticipantData(conference, state) {
* @returns {{
* type: CONFERENCE_FAILED,
* conference: JitsiConference,
* error: string
* error: Error
* }}
* @public
*/
@ -167,7 +167,12 @@ export function conferenceFailed(conference: Object, error: string) {
return {
type: CONFERENCE_FAILED,
conference,
error
// Make the error resemble an Error instance (to the extent that
// jitsi-meet needs it).
error: {
name: error
}
};
}

View File

@ -89,7 +89,7 @@ function _conferenceFailed(state, { conference, error }) {
let authRequired;
let passwordRequired;
switch (error) {
switch (error.name) {
case JitsiConferenceErrors.AUTHENTICATION_REQUIRED:
authRequired = conference;
break;

View File

@ -56,12 +56,20 @@ ReducerRegistry.register('features/overlay', (state = {}, action) => {
* @returns {Object} The new state of the feature overlay after the reduction of
* the specified action.
*/
function _conferenceFailed(state, { error, message }) {
if (error === JitsiConferenceErrors.FOCUS_LEFT
|| error === JitsiConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE) {
function _conferenceFailed(state, { error: { message, name } }) {
if (name === JitsiConferenceErrors.FOCUS_LEFT
|| name === JitsiConferenceErrors.VIDEOBRIDGE_NOT_AVAILABLE) {
return assign(state, {
haveToReload: true,
isNetworkFailure: false,
// FIXME There is no message associated with CONFERENCE_FAILED at
// the time of this writing. In jitsi-meet the action creator
// conferenceFailed neither accepts an argument message nor defines
// a property message on the error. In lib-jitsi-meet
// CONFERENCE_FAILED emissions mostly do not provide a message with
// the exception of at least one which provides an Error, not a
// string.
reason: message
});
}

View File

@ -27,7 +27,8 @@ MiddlewareRegistry.register(store => next => action => {
case CONFERENCE_FAILED: {
const { conference, error } = action;
if (conference && error === JitsiConferenceErrors.PASSWORD_REQUIRED) {
if (conference
&& error.name === JitsiConferenceErrors.PASSWORD_REQUIRED) {
store.dispatch(_openPasswordRequiredPrompt(conference));
}
break;