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.
|
* Create deferred object.
|
||||||
*
|
*
|
||||||
|
@ -15,14 +13,3 @@ export function createDeferred() {
|
||||||
|
|
||||||
return deferred;
|
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 */
|
/* @flow */
|
||||||
|
|
||||||
|
import { reportError } from '../util';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses the query/search or fragment/hash parameters out of a specific URL and
|
* Parses the query/search or fragment/hash parameters out of a specific URL and
|
||||||
* returns them as a JS object.
|
* returns them as a JS object.
|
||||||
|
@ -36,10 +38,8 @@ export default function parseURLParams(
|
||||||
= JSON.parse(decodeURIComponent(value).replace(/\\&/, '&'));
|
= JSON.parse(decodeURIComponent(value).replace(/\\&/, '&'));
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
const msg = `Failed to parse URL parameter value: ${String(value)}`;
|
reportError(
|
||||||
|
e, `Failed to parse URL parameter value: ${String(value)}`);
|
||||||
console.warn(msg, e);
|
|
||||||
window.onerror && window.onerror(msg, null, null, null, e);
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
// @flow
|
// @flow
|
||||||
|
|
||||||
|
const logger = require('jitsi-meet-logger').getLogger(__filename);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the namespace for all global variables, functions, etc that we need.
|
* 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;
|
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';
|
} from '../analytics';
|
||||||
import { _handleParticipantError } from '../base/conference';
|
import { _handleParticipantError } from '../base/conference';
|
||||||
import { MEDIA_TYPE } from '../base/media';
|
import { MEDIA_TYPE } from '../base/media';
|
||||||
|
import { reportError } from '../base/util';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
SELECT_LARGE_VIDEO_PARTICIPANT,
|
SELECT_LARGE_VIDEO_PARTICIPANT,
|
||||||
|
@ -35,14 +36,7 @@ export function selectParticipant() {
|
||||||
|
|
||||||
sendAnalytics(createSelectParticipantFailedEvent(err));
|
sendAnalytics(createSelectParticipantFailedEvent(err));
|
||||||
|
|
||||||
if (typeof APP === 'object' && window.onerror) {
|
reportError(err, `Failed to select participant ${id}`);
|
||||||
window.onerror(
|
|
||||||
`Failed to select participant ${id}`,
|
|
||||||
null, // source
|
|
||||||
null, // lineno
|
|
||||||
null, // colno
|
|
||||||
err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue