ref(utils): use web reportError helper (#3283)
This commit is contained in:
parent
9f015df61d
commit
918fb1dfc6
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue