Przeglądaj źródła

Merge pull request #751 from jitsi/dc_send_throw

Handles the errors thrown by the data channel methods
j8
bgrozev 9 lat temu
rodzic
commit
330597182c
2 zmienionych plików z 34 dodań i 10 usunięć
  1. 22
    10
      conference.js
  2. 12
    0
      modules/util/helpers.js

+ 22
- 10
conference.js Wyświetl plik

@@ -14,6 +14,8 @@ import UIEvents from './service/UI/UIEvents';
14 14
 
15 15
 import mediaDeviceHelper from './modules/devices/mediaDeviceHelper';
16 16
 
17
+import {reportError} from './modules/util/helpers';
18
+
17 19
 const ConnectionEvents = JitsiMeetJS.events.connection;
18 20
 const ConnectionErrors = JitsiMeetJS.errors.connection;
19 21
 
@@ -1153,9 +1155,13 @@ export default {
1153 1155
         ConnectionQuality.addListener(CQEvents.LOCALSTATS_UPDATED,
1154 1156
             (percent, stats) => {
1155 1157
                 APP.UI.updateLocalStats(percent, stats);
1156
-                room.broadcastEndpointMessage({
1157
-                    type: this.commands.defaults.CONNECTION_QUALITY,
1158
-                    values: stats });
1158
+                try {
1159
+                    room.broadcastEndpointMessage({
1160
+                        type: this.commands.defaults.CONNECTION_QUALITY,
1161
+                        values: stats });
1162
+                } catch (e) {
1163
+                    reportError(e);
1164
+                }
1159 1165
             });
1160 1166
 
1161 1167
         room.on(ConferenceEvents.ENDPOINT_MESSAGE_RECEIVED,
@@ -1279,22 +1285,28 @@ export default {
1279 1285
         });
1280 1286
 
1281 1287
         APP.UI.addListener(UIEvents.SELECTED_ENDPOINT, (id) => {
1282
-            room.selectParticipant(id);
1288
+            try {
1289
+                room.selectParticipant(id);
1290
+            } catch (e) {
1291
+                reportError(e);
1292
+            }
1283 1293
         });
1284 1294
 
1285 1295
         APP.UI.addListener(UIEvents.PINNED_ENDPOINT, (smallVideo, isPinned) => {
1286 1296
             var smallVideoId = smallVideo.getId();
1287
-
1288 1297
             if (smallVideo.getVideoType() === VIDEO_CONTAINER_TYPE
1289
-                && !APP.conference.isLocalId(smallVideoId))
1290
-                if (isPinned)
1291
-                    room.pinParticipant(smallVideoId);
1298
+                && !APP.conference.isLocalId(smallVideoId)) {
1299
+
1292 1300
                 // When the library starts supporting multiple pins we would
1293 1301
                 // pass the isPinned parameter together with the identifier,
1294 1302
                 // but currently we send null to indicate that we unpin the
1295 1303
                 // last pinned.
1296
-                else
1297
-                    room.pinParticipant(null);
1304
+                try {
1305
+                    room.pinParticipant(isPinned ? smallVideoId : null);
1306
+                } catch (e) {
1307
+                    reportError(e);
1308
+                }
1309
+            }
1298 1310
         });
1299 1311
 
1300 1312
         APP.UI.addListener(

+ 12
- 0
modules/util/helpers.js Wyświetl plik

@@ -19,3 +19,15 @@ export function createDeferred () {
19 19
 export function reload () {
20 20
     window.location.reload();
21 21
 }
22
+
23
+/**
24
+ * Prints the error and reports it to the global error handler.
25
+ * @param e {Error} the error
26
+ * @param msg {string} [optional] the message printed in addition to the error
27
+ */
28
+export function reportError (e, msg = "") {
29
+    console.error(msg, e);
30
+    if(window.onerror)
31
+        window.onerror(msg, null, null,
32
+            null, e);
33
+}

Ładowanie…
Anuluj
Zapisz