Browse Source

[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.
master
paweldomas 8 years ago
parent
commit
80329e8ffe

+ 4
- 3
react/features/base/connection/actions.native.js View File

76
          * Rejects external promise when connection fails.
76
          * Rejects external promise when connection fails.
77
          *
77
          *
78
          * @param {JitsiConnectionErrors} err - Connection error.
78
          * @param {JitsiConnectionErrors} err - Connection error.
79
+         * @param {string} msg - Error message supplied by lib-jitsi-meet.
79
          * @returns {void}
80
          * @returns {void}
80
          * @private
81
          * @private
81
          */
82
          */
82
-        function _onConnectionFailed(err) {
83
+        function _onConnectionFailed(err, msg) {
83
             unsubscribe();
84
             unsubscribe();
84
-            console.error('CONNECTION FAILED:', err);
85
-            dispatch(connectionFailed(connection, err));
85
+            console.error('CONNECTION FAILED:', err, msg);
86
+            dispatch(connectionFailed(connection, err, msg));
86
         }
87
         }
87
 
88
 
88
         /**
89
         /**

+ 17
- 5
react/features/base/connection/reducer.js View File

1
 /* @flow */
1
 /* @flow */
2
 
2
 
3
-import { assign, ReducerRegistry, set } from '../redux';
3
+import { assign, ReducerRegistry } from '../redux';
4
 import { parseURIString } from '../util';
4
 import { parseURIString } from '../util';
5
 
5
 
6
 import {
6
 import {
75
         { connection }: { connection: Object }) {
75
         { connection }: { connection: Object }) {
76
     return assign(state, {
76
     return assign(state, {
77
         connecting: undefined,
77
         connecting: undefined,
78
-        connection
78
+        connection,
79
+        error: undefined,
80
+        errorMessage: undefined
79
     });
81
     });
80
 }
82
 }
81
 
83
 
91
  */
93
  */
92
 function _connectionFailed(
94
 function _connectionFailed(
93
         state: Object,
95
         state: Object,
94
-        { connection }: { connection: Object }) {
96
+        { connection, error, message }: {
97
+            connection: Object,
98
+            error: string,
99
+            message: ?string
100
+        }) {
95
     if (state.connection && state.connection !== connection) {
101
     if (state.connection && state.connection !== connection) {
96
         return state;
102
         return state;
97
     }
103
     }
98
 
104
 
99
     return assign(state, {
105
     return assign(state, {
100
         connecting: undefined,
106
         connecting: undefined,
101
-        connection: undefined
107
+        connection: undefined,
108
+        error,
109
+        errorMessage: message
102
     });
110
     });
103
 }
111
 }
104
 
112
 
115
 function _connectionWillConnect(
123
 function _connectionWillConnect(
116
         state: Object,
124
         state: Object,
117
         { connection }: { connection: Object }) {
125
         { connection }: { connection: Object }) {
118
-    return set(state, 'connecting', connection);
126
+    return assign(state, {
127
+        connecting: connection,
128
+        error: undefined,
129
+        errorMessage: undefined
130
+    });
119
 }
131
 }
120
 
132
 
121
 /**
133
 /**

Loading…
Cancel
Save