Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

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

virtuacoplenny918fb1dfc648
diff --git a/modules/util/helpers.js b/modules/util/helpers.js
index d8fcf4dfc1..b365ef4235 100644
--- a/modules/util/helpers.js
+++ b/modules/util/helpers.js
@@ -1,5 +1,3 @@
-const logger = require('jitsi-meet-logger').getLogger(__filename);
-
/**
* Create deferred object.
*
@@ -15,14 +13,3 @@ export function createDeferred() {
return deferred;
}
-
-/**
- * Prints the error and reports it to the global error handler.
- *
- * @param e {Error} the error
- * @param msg {string} [optional] the message printed in addition to the error
- */
-export function reportError(e, msg = '') {
- logger.error(msg, e);
- window.onerror && window.onerror(msg, null, null, null, e);
-}
diff --git a/react/features/base/config/parseURLParams.js b/react/features/base/config/parseURLParams.js
index 6603bec265..097c9869a2 100644
--- a/react/features/base/config/parseURLParams.js
+++ b/react/features/base/config/parseURLParams.js
@@ -1,5 +1,7 @@
/* @flow */
+import { reportError } from '../util';
+
/**
* Parses the query/search or fragment/hash parameters out of a specific URL and
* returns them as a JS object.
@@ -36,10 +38,8 @@ export default function parseURLParams(
= JSON.parse(decodeURIComponent(value).replace(/\\&/, '&'));
}
} catch (e) {
- const msg = `Failed to parse URL parameter value: ${String(value)}`;
-
- console.warn(msg, e);
- window.onerror && window.onerror(msg, null, null, null, e);
+ reportError(
+ e, `Failed to parse URL parameter value: ${String(value)}`);
return;
}
diff --git a/react/features/base/util/helpers.js b/react/features/base/util/helpers.js
index 951d5a0f15..9b4e6d30e7 100644
--- a/react/features/base/util/helpers.js
+++ b/react/features/base/util/helpers.js
@@ -1,5 +1,7 @@
// @flow
+const logger = require('jitsi-meet-logger').getLogger(__filename);
+
/**
* Returns the namespace for all global variables, functions, etc that we need.
*
@@ -65,3 +67,15 @@ export function assignIfDefined(target: Object, source: Object) {
return to;
}
+
+/**
+ * Prints the error and reports it to the global error handler.
+ *
+ * @param {Error} e - The error object.
+ * @param {string} msg - A custom message to print in addition to the error.
+ * @returns {void}
+ */
+export function reportError(e: Object, msg: string = '') {
+ logger.error(msg, e);
+ window.onerror && window.onerror(msg, null, null, null, e);
+}
diff --git a/react/features/large-video/actions.js b/react/features/large-video/actions.js
index 73530767e3..a5f9e8eecf 100644
--- a/react/features/large-video/actions.js
+++ b/react/features/large-video/actions.js
@@ -6,6 +6,7 @@ import {
} from '../analytics';
import { _handleParticipantError } from '../base/conference';
import { MEDIA_TYPE } from '../base/media';
+import { reportError } from '../base/util';
import {
SELECT_LARGE_VIDEO_PARTICIPANT,
@@ -35,14 +36,7 @@ export function selectParticipant() {
sendAnalytics(createSelectParticipantFailedEvent(err));
- if (typeof APP === 'object' && window.onerror) {
- window.onerror(
- `Failed to select participant ${id}`,
- null, // source
- null, // lineno
- null, // colno
- err);
- }
+ reportError(err, `Failed to select participant ${id}`);
}
}
};