fix(logging): Add more details to onerror and onunhandledrejection errors.
This commit is contained in:
parent
d2046c2c8f
commit
30fc04ba61
|
@ -104,8 +104,10 @@ function _setErrorHandlers() {
|
|||
|
||||
// eslint-disable-next-line max-params
|
||||
window.onerror = (message, source, lineno, colno, error) => {
|
||||
JitsiMeetJS.getGlobalOnErrorHandler(
|
||||
message, source, lineno, colno, error);
|
||||
const errMsg = message || (error && error.message);
|
||||
const stack = error && error.stack;
|
||||
|
||||
JitsiMeetJS.getGlobalOnErrorHandler(errMsg, source, lineno, colno, stack);
|
||||
|
||||
if (oldOnErrorHandler) {
|
||||
oldOnErrorHandler(message, source, lineno, colno, error);
|
||||
|
@ -115,8 +117,14 @@ function _setErrorHandlers() {
|
|||
const oldOnUnhandledRejection = window.onunhandledrejection;
|
||||
|
||||
window.onunhandledrejection = function(event) {
|
||||
JitsiMeetJS.getGlobalOnErrorHandler(
|
||||
null, null, null, null, event.reason);
|
||||
let message = event.reason;
|
||||
let stack = 'n/a';
|
||||
|
||||
if (event.reason instanceof Error) {
|
||||
({ message, stack } = event.reason);
|
||||
}
|
||||
|
||||
JitsiMeetJS.getGlobalOnErrorHandler(message, null, null, null, stack);
|
||||
|
||||
if (oldOnUnhandledRejection) {
|
||||
oldOnUnhandledRejection(event);
|
||||
|
|
Loading…
Reference in New Issue