Przeglądaj źródła

ref(utils): use web reportError helper (#3283)

master
virtuacoplenny 6 lat temu
rodzic
commit
918fb1dfc6
No account linked to committer's email address

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

@@ -1,5 +1,3 @@
1
-const logger = require('jitsi-meet-logger').getLogger(__filename);
2
-
3 1
 /**
4 2
  * Create deferred object.
5 3
  *
@@ -15,14 +13,3 @@ export function createDeferred() {
15 13
 
16 14
     return deferred;
17 15
 }
18
-
19
-/**
20
- * Prints the error and reports it to the global error handler.
21
- *
22
- * @param e {Error} the error
23
- * @param msg {string} [optional] the message printed in addition to the error
24
- */
25
-export function reportError(e, msg = '') {
26
-    logger.error(msg, e);
27
-    window.onerror && window.onerror(msg, null, null, null, e);
28
-}

+ 4
- 4
react/features/base/config/parseURLParams.js Wyświetl plik

@@ -1,5 +1,7 @@
1 1
 /* @flow */
2 2
 
3
+import { reportError } from '../util';
4
+
3 5
 /**
4 6
  * Parses the query/search or fragment/hash parameters out of a specific URL and
5 7
  * returns them as a JS object.
@@ -36,10 +38,8 @@ export default function parseURLParams(
36 38
                     = JSON.parse(decodeURIComponent(value).replace(/\\&/, '&'));
37 39
             }
38 40
         } catch (e) {
39
-            const msg = `Failed to parse URL parameter value: ${String(value)}`;
40
-
41
-            console.warn(msg, e);
42
-            window.onerror && window.onerror(msg, null, null, null, e);
41
+            reportError(
42
+                e, `Failed to parse URL parameter value: ${String(value)}`);
43 43
 
44 44
             return;
45 45
         }

+ 14
- 0
react/features/base/util/helpers.js Wyświetl plik

@@ -1,5 +1,7 @@
1 1
 // @flow
2 2
 
3
+const logger = require('jitsi-meet-logger').getLogger(__filename);
4
+
3 5
 /**
4 6
  * Returns the namespace for all global variables, functions, etc that we need.
5 7
  *
@@ -65,3 +67,15 @@ export function assignIfDefined(target: Object, source: Object) {
65 67
 
66 68
     return to;
67 69
 }
70
+
71
+/**
72
+ * Prints the error and reports it to the global error handler.
73
+ *
74
+ * @param {Error} e - The error object.
75
+ * @param {string} msg - A custom message to print in addition to the error.
76
+ * @returns {void}
77
+ */
78
+export function reportError(e: Object, msg: string = '') {
79
+    logger.error(msg, e);
80
+    window.onerror && window.onerror(msg, null, null, null, e);
81
+}

+ 2
- 8
react/features/large-video/actions.js Wyświetl plik

@@ -6,6 +6,7 @@ import {
6 6
 } from '../analytics';
7 7
 import { _handleParticipantError } from '../base/conference';
8 8
 import { MEDIA_TYPE } from '../base/media';
9
+import { reportError } from '../base/util';
9 10
 
10 11
 import {
11 12
     SELECT_LARGE_VIDEO_PARTICIPANT,
@@ -35,14 +36,7 @@ export function selectParticipant() {
35 36
 
36 37
                 sendAnalytics(createSelectParticipantFailedEvent(err));
37 38
 
38
-                if (typeof APP === 'object' && window.onerror) {
39
-                    window.onerror(
40
-                        `Failed to select participant ${id}`,
41
-                        null, // source
42
-                        null, // lineno
43
-                        null, // colno
44
-                        err);
45
-                }
39
+                reportError(err, `Failed to select participant ${id}`);
46 40
             }
47 41
         }
48 42
     };

Ładowanie…
Anuluj
Zapisz