Browse Source

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

master
virtuacoplenny 6 years ago
parent
commit
918fb1dfc6
No account linked to committer's email address

+ 0
- 13
modules/util/helpers.js View File

1
-const logger = require('jitsi-meet-logger').getLogger(__filename);
2
-
3
 /**
1
 /**
4
  * Create deferred object.
2
  * Create deferred object.
5
  *
3
  *
15
 
13
 
16
     return deferred;
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 View File

1
 /* @flow */
1
 /* @flow */
2
 
2
 
3
+import { reportError } from '../util';
4
+
3
 /**
5
 /**
4
  * Parses the query/search or fragment/hash parameters out of a specific URL and
6
  * Parses the query/search or fragment/hash parameters out of a specific URL and
5
  * returns them as a JS object.
7
  * returns them as a JS object.
36
                     = JSON.parse(decodeURIComponent(value).replace(/\\&/, '&'));
38
                     = JSON.parse(decodeURIComponent(value).replace(/\\&/, '&'));
37
             }
39
             }
38
         } catch (e) {
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
             return;
44
             return;
45
         }
45
         }

+ 14
- 0
react/features/base/util/helpers.js View File

1
 // @flow
1
 // @flow
2
 
2
 
3
+const logger = require('jitsi-meet-logger').getLogger(__filename);
4
+
3
 /**
5
 /**
4
  * Returns the namespace for all global variables, functions, etc that we need.
6
  * Returns the namespace for all global variables, functions, etc that we need.
5
  *
7
  *
65
 
67
 
66
     return to;
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 View File

6
 } from '../analytics';
6
 } from '../analytics';
7
 import { _handleParticipantError } from '../base/conference';
7
 import { _handleParticipantError } from '../base/conference';
8
 import { MEDIA_TYPE } from '../base/media';
8
 import { MEDIA_TYPE } from '../base/media';
9
+import { reportError } from '../base/util';
9
 
10
 
10
 import {
11
 import {
11
     SELECT_LARGE_VIDEO_PARTICIPANT,
12
     SELECT_LARGE_VIDEO_PARTICIPANT,
35
 
36
 
36
                 sendAnalytics(createSelectParticipantFailedEvent(err));
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
     };

Loading…
Cancel
Save