소스 검색

fix(GlobalOnErrorHandler) avoid calling it when we handle the error

release-8443
Saúl Ibarra Corretgé 1 년 전
부모
커밋
30cb694dff

+ 0
- 4
JitsiConference.js 파일 보기

@@ -38,7 +38,6 @@ import AvgRTPStatsReporter from './modules/statistics/AvgRTPStatsReporter';
38 38
 import LocalStatsCollector from './modules/statistics/LocalStatsCollector';
39 39
 import SpeakerStatsCollector from './modules/statistics/SpeakerStatsCollector';
40 40
 import Statistics from './modules/statistics/statistics';
41
-import GlobalOnErrorHandler from './modules/util/GlobalOnErrorHandler';
42 41
 import { safeSubtract } from './modules/util/MathUtil';
43 42
 import RandomUtil from './modules/util/RandomUtil';
44 43
 import ComponentsVersions from './modules/version/ComponentsVersions';
@@ -2195,7 +2194,6 @@ JitsiConference.prototype._acceptJvbIncomingCall = function(jingleSession, jingl
2195 2194
                 enableInsertableStreams: this.isE2EEEnabled() || FeatureFlags.isRunInLiteModeEnabled()
2196 2195
             });
2197 2196
     } catch (error) {
2198
-        GlobalOnErrorHandler.callErrorHandler(error);
2199 2197
         logger.error(error);
2200 2198
 
2201 2199
         return;
@@ -2223,7 +2221,6 @@ JitsiConference.prototype._acceptJvbIncomingCall = function(jingleSession, jingl
2223 2221
                 }
2224 2222
             },
2225 2223
             error => {
2226
-                GlobalOnErrorHandler.callErrorHandler(error);
2227 2224
                 logger.error('Failed to accept incoming Jingle session', error);
2228 2225
             },
2229 2226
             localTracks
@@ -2235,7 +2232,6 @@ JitsiConference.prototype._acceptJvbIncomingCall = function(jingleSession, jingl
2235 2232
 
2236 2233
         this.statistics.startRemoteStats(this.jvbJingleSession.peerconnection);
2237 2234
     } catch (e) {
2238
-        GlobalOnErrorHandler.callErrorHandler(e);
2239 2235
         logger.error(e);
2240 2236
     }
2241 2237
 };

+ 0
- 2
modules/RTC/BridgeChannel.js 파일 보기

@@ -4,7 +4,6 @@ import { getLogger } from '@jitsi/logger';
4 4
 import RTCEvents from '../../service/RTC/RTCEvents';
5 5
 import { createBridgeChannelClosedEvent } from '../../service/statistics/AnalyticsEvents';
6 6
 import Statistics from '../statistics/statistics';
7
-import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
8 7
 
9 8
 const logger = getLogger(__filename);
10 9
 
@@ -295,7 +294,6 @@ export default class BridgeChannel {
295 294
             try {
296 295
                 obj = safeJsonParse(data);
297 296
             } catch (error) {
298
-                GlobalOnErrorHandler.callErrorHandler(error);
299 297
                 logger.error('Failed to parse channel message as JSON: ', data, error);
300 298
 
301 299
                 return;

+ 0
- 2
modules/RTC/RTC.js 파일 보기

@@ -5,7 +5,6 @@ import * as JitsiConferenceEvents from '../../JitsiConferenceEvents';
5 5
 import { MediaType } from '../../service/RTC/MediaType';
6 6
 import RTCEvents from '../../service/RTC/RTCEvents';
7 7
 import browser from '../browser';
8
-import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
9 8
 import Listenable from '../util/Listenable';
10 9
 import { safeCounterIncrement } from '../util/MathUtil';
11 10
 
@@ -198,7 +197,6 @@ export default class RTC extends Listenable {
198 197
 
199 198
         this._channelOpenListener = () => {
200 199
             const logError = (error, msgType, value) => {
201
-                GlobalOnErrorHandler.callErrorHandler(error);
202 200
                 logger.error(`Cannot send ${msgType}(${JSON.stringify(value)}) endpoint message`, error);
203 201
             };
204 202
 

+ 1
- 7
modules/RTC/RTCUtils.js 파일 보기

@@ -12,7 +12,6 @@ import { VideoType } from '../../service/RTC/VideoType';
12 12
 import { AVAILABLE_DEVICE } from '../../service/statistics/AnalyticsEvents';
13 13
 import browser from '../browser';
14 14
 import Statistics from '../statistics/statistics';
15
-import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
16 15
 import Listenable from '../util/Listenable';
17 16
 
18 17
 import screenObtainer from './ScreenObtainer';
@@ -873,15 +872,10 @@ function wrapAttachMediaStream(origAttachMediaStream) {
873 872
 
874 873
                 // we skip setting audio output if there was no explicit change
875 874
                 && audioOutputChanged) {
876
-            return element.setSinkId(rtcUtils.getAudioOutputDevice()).catch(function(ex) {
875
+            return element.setSinkId(rtcUtils.getAudioOutputDevice()).catch(ex => {
877 876
                 const err
878 877
                     = new JitsiTrackError(ex, null, [ 'audiooutput' ]);
879 878
 
880
-                GlobalOnErrorHandler.callUnhandledRejectionHandler({
881
-                    promise: this, // eslint-disable-line no-invalid-this
882
-                    reason: err
883
-                });
884
-
885 879
                 logger.warn(
886 880
                     'Failed to set audio output device for the element.'
887 881
                         + ' Default audio output device will be used'

+ 12
- 18
modules/RTC/TraceablePeerConnection.js 파일 보기

@@ -19,7 +19,6 @@ import SDPUtil from '../sdp/SDPUtil';
19 19
 import SdpConsistency from '../sdp/SdpConsistency';
20 20
 import SdpSimulcast from '../sdp/SdpSimulcast';
21 21
 import { SdpTransformWrap } from '../sdp/SdpTransformUtil';
22
-import * as GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
23 22
 
24 23
 import JitsiRemoteTrack from './JitsiRemoteTrack';
25 24
 import RTC from './RTC';
@@ -959,8 +958,7 @@ TraceablePeerConnection.prototype._remoteTrackAdded = function(stream, track, tr
959 958
 
960 959
     // look up an associated JID for a stream id
961 960
     if (!mediaType) {
962
-        GlobalOnErrorHandler.callErrorHandler(
963
-            new Error(`MediaType undefined for remote track, stream id: ${streamId}, track creation failed!`));
961
+        logger.error(`MediaType undefined for remote track, stream id: ${streamId}, track creation failed!`);
964 962
 
965 963
         return;
966 964
     }
@@ -988,9 +986,8 @@ TraceablePeerConnection.prototype._remoteTrackAdded = function(stream, track, tr
988 986
     }
989 987
 
990 988
     if (!mediaLine) {
991
-        GlobalOnErrorHandler.callErrorHandler(
992
-            new Error(`Matching media line not found in remote SDP for remote stream[id=${streamId},type=${mediaType}],`
993
-                + 'track creation failed!'));
989
+        logger.error(`Matching media line not found in remote SDP for remote stream[id=${streamId},type=${mediaType}],`
990
+                + 'track creation failed!');
994 991
 
995 992
         return;
996 993
     }
@@ -999,9 +996,8 @@ TraceablePeerConnection.prototype._remoteTrackAdded = function(stream, track, tr
999 996
 
1000 997
     ssrcLines = ssrcLines.filter(line => line.indexOf(`msid:${streamId}`) !== -1);
1001 998
     if (!ssrcLines.length) {
1002
-        GlobalOnErrorHandler.callErrorHandler(
1003
-            new Error(`No SSRC lines found in remote SDP for remote stream[msid=${streamId},type=${mediaType}]`
1004
-                + 'track creation failed!'));
999
+        logger.error(`No SSRC lines found in remote SDP for remote stream[msid=${streamId},type=${mediaType}]`
1000
+                + 'track creation failed!');
1005 1001
 
1006 1002
         return;
1007 1003
     }
@@ -1013,17 +1009,15 @@ TraceablePeerConnection.prototype._remoteTrackAdded = function(stream, track, tr
1013 1009
     const ownerEndpointId = this.signalingLayer.getSSRCOwner(trackSsrc);
1014 1010
 
1015 1011
     if (isNaN(trackSsrc) || trackSsrc < 0) {
1016
-        GlobalOnErrorHandler.callErrorHandler(
1017
-            new Error(`Invalid SSRC for remote stream[ssrc=${trackSsrc},id=${streamId},type=${mediaType}]`
1018
-                + 'track creation failed!'));
1012
+        logger.error(`Invalid SSRC for remote stream[ssrc=${trackSsrc},id=${streamId},type=${mediaType}]`
1013
+                + 'track creation failed!');
1019 1014
 
1020 1015
         return;
1021 1016
     }
1022 1017
 
1023 1018
     if (!ownerEndpointId) {
1024
-        GlobalOnErrorHandler.callErrorHandler(
1025
-            new Error(`No SSRC owner known for remote stream[ssrc=${trackSsrc},id=${streamId},type=${mediaType}]`
1026
-            + 'track creation failed!'));
1019
+        logger.error(`No SSRC owner known for remote stream[ssrc=${trackSsrc},id=${streamId},type=${mediaType}]`
1020
+            + 'track creation failed!');
1027 1021
 
1028 1022
         return;
1029 1023
     }
@@ -1152,13 +1146,13 @@ TraceablePeerConnection.prototype._remoteTrackRemoved = function(stream, track)
1152 1146
     }
1153 1147
 
1154 1148
     if (!streamId) {
1155
-        GlobalOnErrorHandler.callErrorHandler(new Error(`${this} remote track removal failed - no stream ID`));
1149
+        logger.error(`${this} remote track removal failed - no stream ID`);
1156 1150
 
1157 1151
         return;
1158 1152
     }
1159 1153
 
1160 1154
     if (!trackId) {
1161
-        GlobalOnErrorHandler.callErrorHandler(new Error(`${this} remote track removal failed - no track ID`));
1155
+        logger.error(`${this} remote track removal failed - no track ID`);
1162 1156
 
1163 1157
         return;
1164 1158
     }
@@ -1167,7 +1161,7 @@ TraceablePeerConnection.prototype._remoteTrackRemoved = function(stream, track)
1167 1161
         remoteTrack => remoteTrack.getStreamId() === streamId && remoteTrack.getTrackId() === trackId);
1168 1162
 
1169 1163
     if (!toBeRemoved) {
1170
-        GlobalOnErrorHandler.callErrorHandler(new Error(`${this} remote track removal failed - track not found`));
1164
+        logger.error(`${this} remote track removal failed - track not found`);
1171 1165
 
1172 1166
         return;
1173 1167
     }

+ 0
- 4
modules/statistics/RTPStatsCollector.js 파일 보기

@@ -5,8 +5,6 @@ import * as StatisticsEvents from '../../service/statistics/Events';
5 5
 import browser from '../browser';
6 6
 import FeatureFlags from '../flags/FeatureFlags';
7 7
 
8
-const GlobalOnErrorHandler = require('../util/GlobalOnErrorHandler');
9
-
10 8
 const logger = getLogger(__filename);
11 9
 
12 10
 /**
@@ -185,7 +183,6 @@ StatsCollector.prototype.stop = function() {
185 183
  * @param error an error that occurred on <tt>getStats</tt> call.
186 184
  */
187 185
 StatsCollector.prototype.errorCallback = function(error) {
188
-    GlobalOnErrorHandler.callErrorHandler(error);
189 186
     logger.error('Get stats error', error);
190 187
     this.stop();
191 188
 };
@@ -228,7 +225,6 @@ StatsCollector.prototype.start = function(startAudioLevelStats) {
228 225
                 try {
229 226
                     this.processStatsReport();
230 227
                 } catch (error) {
231
-                    GlobalOnErrorHandler.callErrorHandler(error);
232 228
                     logger.error('Processing of RTP stats failed:', error);
233 229
                 }
234 230
                 this.previousStatsReport = this.currentStatsReport;

+ 1
- 8
modules/xmpp/ChatRoom.js 파일 보기

@@ -11,7 +11,6 @@ import AuthenticationEvents from '../../service/authentication/AuthenticationEve
11 11
 import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
12 12
 import Settings from '../settings/Settings';
13 13
 import EventEmitterForwarder from '../util/EventEmitterForwarder';
14
-import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
15 14
 import Listenable from '../util/Listenable';
16 15
 
17 16
 import AVModeration from './AVModeration';
@@ -404,7 +403,6 @@ export default class ChatRoom extends Listenable {
404 403
                 }
405 404
             }
406 405
         }, error => {
407
-            GlobalOnErrorHandler.callErrorHandler(error);
408 406
             logger.error('Error getting room info: ', error);
409 407
         });
410 408
     }
@@ -445,10 +443,7 @@ export default class ChatRoom extends Listenable {
445 443
             if (!$(form).find(
446 444
                     '>query>x[xmlns="jabber:x:data"]'
447 445
                     + '>field[var="muc#roomconfig_whois"]').length) {
448
-                const errmsg = 'non-anonymous rooms not supported';
449
-
450
-                GlobalOnErrorHandler.callErrorHandler(new Error(errmsg));
451
-                logger.error(errmsg);
446
+                logger.error('non-anonymous rooms not supported');
452 447
 
453 448
                 return;
454 449
             }
@@ -470,7 +465,6 @@ export default class ChatRoom extends Listenable {
470 465
             this.connection.sendIQ(formSubmit);
471 466
 
472 467
         }, error => {
473
-            GlobalOnErrorHandler.callErrorHandler(error);
474 468
             logger.error('Error getting room configuration form: ', error);
475 469
         });
476 470
     }
@@ -895,7 +889,6 @@ export default class ChatRoom extends Listenable {
895 889
                 });
896 890
             }
897 891
         } catch (e) {
898
-            GlobalOnErrorHandler.callErrorHandler(e);
899 892
             logger.error(`Error processing:${node.tagName} node.`, e);
900 893
         }
901 894
     }

+ 2
- 8
modules/xmpp/JingleSessionPC.js 파일 보기

@@ -17,7 +17,6 @@ import SDPDiffer from '../sdp/SDPDiffer';
17 17
 import SDPUtil from '../sdp/SDPUtil';
18 18
 import Statistics from '../statistics/statistics';
19 19
 import AsyncQueue, { ClearedQueueError } from '../util/AsyncQueue';
20
-import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
21 20
 
22 21
 import browser from './../browser';
23 22
 import JingleSession from './JingleSession';
@@ -706,10 +705,7 @@ export default class JingleSessionPC extends JingleSession {
706 705
             const jcand = SDPUtil.candidateToJingle(candidate.candidate);
707 706
 
708 707
             if (!(ice && jcand)) {
709
-                const errorMesssage = 'failed to get ice && jcand';
710
-
711
-                GlobalOnErrorHandler.callErrorHandler(new Error(errorMesssage));
712
-                logger.error(errorMesssage);
708
+                logger.error('failed to get ice && jcand');
713 709
 
714 710
                 return;
715 711
             }
@@ -2777,9 +2773,7 @@ export default class JingleSessionPC extends JingleSession {
2777 2773
                 // We don't want to have that logged on error level.
2778 2774
                 logger.debug(`${this} Jingle error: ${JSON.stringify(error)}`);
2779 2775
             } else {
2780
-                GlobalOnErrorHandler.callErrorHandler(
2781
-                    new Error(
2782
-                        `Jingle error: ${JSON.stringify(error)}`));
2776
+                logger.error(`Jingle error: ${JSON.stringify(error)}`);
2783 2777
             }
2784 2778
         };
2785 2779
     }

+ 2
- 10
modules/xmpp/moderator.js 파일 보기

@@ -11,7 +11,6 @@ import Listenable from '../util/Listenable';
11 11
 const AuthenticationEvents
12 12
     = require('../../service/authentication/AuthenticationEvents');
13 13
 const { XMPPEvents } = require('../../service/xmpp/XMPPEvents');
14
-const GlobalOnErrorHandler = require('../util/GlobalOnErrorHandler');
15 14
 
16 15
 const logger = getLogger(__filename);
17 16
 
@@ -449,11 +448,7 @@ export default class Moderator extends Listenable {
449 448
             window.setTimeout(() => this.sendConferenceRequest(roomJid)
450 449
                 .then(callback), waitMs);
451 450
         } else {
452
-            const errmsg = 'Failed to get a successful response, giving up.';
453
-            const error = new Error(errmsg);
454
-
455
-            logger.error(errmsg, error);
456
-            GlobalOnErrorHandler.callErrorHandler(error);
451
+            logger.error('Failed to get a successful response, giving up.');
457 452
 
458 453
             // This is a "fatal" error and the user of the lib should handle it accordingly.
459 454
             // TODO: change the event name to something accurate.
@@ -579,10 +574,7 @@ export default class Moderator extends Listenable {
579 574
                 callback();
580 575
             },
581 576
             error => {
582
-                const errmsg = 'Logout error';
583
-
584
-                GlobalOnErrorHandler.callErrorHandler(new Error(errmsg));
585
-                logger.error(errmsg, error);
577
+                logger.error('Logout error', error);
586 578
             }
587 579
         );
588 580
     }

+ 0
- 2
modules/xmpp/strophe.jingle.js 파일 보기

@@ -11,7 +11,6 @@ import {
11 11
 } from '../../service/statistics/AnalyticsEvents';
12 12
 import { XMPPEvents } from '../../service/xmpp/XMPPEvents';
13 13
 import Statistics from '../statistics/statistics';
14
-import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
15 14
 import RandomUtil from '../util/RandomUtil';
16 15
 
17 16
 import ConnectionPlugin from './ConnectionPlugin';
@@ -285,7 +284,6 @@ export default class JingleConnectionPlugin extends ConnectionPlugin {
285 284
                         value: successTime
286 285
                     }));
287 286
             }, error => {
288
-                GlobalOnErrorHandler.callErrorHandler(error);
289 287
                 logger.error('Transport replace failed', error);
290 288
                 sess.sendTransportReject();
291 289
             });

+ 0
- 3
modules/xmpp/strophe.ping.js 파일 보기

@@ -1,8 +1,6 @@
1 1
 import { getLogger } from '@jitsi/logger';
2 2
 import { $iq, Strophe } from 'strophe.js';
3 3
 
4
-import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
5
-
6 4
 import ConnectionPlugin from './ConnectionPlugin';
7 5
 
8 6
 
@@ -129,7 +127,6 @@ export default class PingConnectionPlugin extends ConnectionPlugin {
129 127
                 const errmsg = `Ping ${error ? 'error' : 'timeout'}`;
130 128
 
131 129
                 if (this.failedPings >= this.pingThreshold) {
132
-                    GlobalOnErrorHandler.callErrorHandler(new Error(errmsg));
133 130
                     logger.error(errmsg, error);
134 131
                     this._onPingThresholdExceeded && this._onPingThresholdExceeded();
135 132
                 } else {

+ 1
- 6
modules/xmpp/strophe.util.js 파일 보기

@@ -4,8 +4,6 @@
4 4
 import { getLogger } from '@jitsi/logger';
5 5
 import { Strophe } from 'strophe.js';
6 6
 
7
-import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
8
-
9 7
 const logger = getLogger(__filename);
10 8
 
11 9
 /**
@@ -83,10 +81,7 @@ export default function() {
83 81
             break;
84 82
         case Strophe.LogLevel.ERROR:
85 83
         case Strophe.LogLevel.FATAL:
86
-            // eslint-disable-next-line no-param-reassign
87
-            msg = `Strophe: ${msg}`;
88
-            GlobalOnErrorHandler.callErrorHandler(new Error(msg));
89
-            logger.error(msg);
84
+            logger.error(`Strophe: ${msg}`, msg);
90 85
             break;
91 86
         }
92 87
 

+ 1
- 6
modules/xmpp/xmpp.js 파일 보기

@@ -11,7 +11,6 @@ import browser from '../browser';
11 11
 import { E2EEncryption } from '../e2ee/E2EEncryption';
12 12
 import FeatureFlags from '../flags/FeatureFlags';
13 13
 import Statistics from '../statistics/statistics';
14
-import GlobalOnErrorHandler from '../util/GlobalOnErrorHandler';
15 14
 import Listenable from '../util/Listenable';
16 15
 import RandomUtil from '../util/RandomUtil';
17 16
 
@@ -339,11 +338,7 @@ export default class XMPP extends Listenable {
339 338
                         identities, undefined /* when querying we will query for features */);
340 339
                 })
341 340
                 .catch(error => {
342
-                    const errmsg = 'Feature discovery error';
343
-
344
-                    GlobalOnErrorHandler.callErrorHandler(
345
-                        new Error(`${errmsg}: ${error}`));
346
-                    logger.error(errmsg, error);
341
+                    logger.error('Feature discovery error', error);
347 342
 
348 343
                     this._maybeSendDeploymentInfoStat(true);
349 344
                 });

Loading…
취소
저장