Browse Source

CONFERENCE_FAILED error as object

master
Lyubo Marinov 7 years ago
parent
commit
c98e7a204c

+ 2
- 1
react/features/authentication/middleware.js View File

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

+ 1
- 1
react/features/base/conference/actionTypes.js View File

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

+ 7
- 2
react/features/base/conference/actions.js View File

@@ -159,7 +159,7 @@ function _setLocalParticipantData(conference, state) {
159 159
  * @returns {{
160 160
  *     type: CONFERENCE_FAILED,
161 161
  *     conference: JitsiConference,
162
- *     error: string
162
+ *     error: Error
163 163
  * }}
164 164
  * @public
165 165
  */
@@ -167,7 +167,12 @@ export function conferenceFailed(conference: Object, error: string) {
167 167
     return {
168 168
         type: CONFERENCE_FAILED,
169 169
         conference,
170
-        error
170
+
171
+        // Make the error resemble an Error instance (to the extent that
172
+        // jitsi-meet needs it).
173
+        error: {
174
+            name: error
175
+        }
171 176
     };
172 177
 }
173 178
 

+ 1
- 1
react/features/base/conference/reducer.js View File

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

+ 11
- 3
react/features/overlay/reducer.js View File

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

+ 2
- 1
react/features/room-lock/middleware.js View File

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

Loading…
Cancel
Save