[RN] CONFERENCE_FAILED error message in redux

In order to support XMPP authentication, we'll need the message
accompanying the error and carried by lib-jitsi-meet's
CONFERENCE_FAILED in the redux store. We already carry the message in
the redux action and we've got the error in the redux store.
This commit is contained in:
paweldomas 2017-09-19 14:14:17 -05:00 committed by Lyubo Marinov
parent 9621ba03f3
commit 80329e8ffe
2 changed files with 21 additions and 8 deletions

View File

@ -76,13 +76,14 @@ export function connect() {
* Rejects external promise when connection fails.
*
* @param {JitsiConnectionErrors} err - Connection error.
* @param {string} msg - Error message supplied by lib-jitsi-meet.
* @returns {void}
* @private
*/
function _onConnectionFailed(err) {
function _onConnectionFailed(err, msg) {
unsubscribe();
console.error('CONNECTION FAILED:', err);
dispatch(connectionFailed(connection, err));
console.error('CONNECTION FAILED:', err, msg);
dispatch(connectionFailed(connection, err, msg));
}
/**

View File

@ -1,6 +1,6 @@
/* @flow */
import { assign, ReducerRegistry, set } from '../redux';
import { assign, ReducerRegistry } from '../redux';
import { parseURIString } from '../util';
import {
@ -75,7 +75,9 @@ function _connectionEstablished(
{ connection }: { connection: Object }) {
return assign(state, {
connecting: undefined,
connection
connection,
error: undefined,
errorMessage: undefined
});
}
@ -91,14 +93,20 @@ function _connectionEstablished(
*/
function _connectionFailed(
state: Object,
{ connection }: { connection: Object }) {
{ connection, error, message }: {
connection: Object,
error: string,
message: ?string
}) {
if (state.connection && state.connection !== connection) {
return state;
}
return assign(state, {
connecting: undefined,
connection: undefined
connection: undefined,
error,
errorMessage: message
});
}
@ -115,7 +123,11 @@ function _connectionFailed(
function _connectionWillConnect(
state: Object,
{ connection }: { connection: Object }) {
return set(state, 'connecting', connection);
return assign(state, {
connecting: connection,
error: undefined,
errorMessage: undefined
});
}
/**