From aa2d324cab483f9fafc7eb559a3101deb01e845d Mon Sep 17 00:00:00 2001 From: Ruben van de Ven Date: Mon, 28 Sep 2020 11:21:00 +0200 Subject: [PATCH] improve error handling and logging --- dist/static/assets/webcam.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/static/assets/webcam.js b/dist/static/assets/webcam.js index 3e95a0ca..07c5fa1c 100644 --- a/dist/static/assets/webcam.js +++ b/dist/static/assets/webcam.js @@ -425,8 +425,8 @@ window.onerror = function (msg, url, lineNumber, columnNo, error) { // var fileInfo = getScriptOff(errorNum); // data = msg + ' (' + fileInfo[1] + ': line ' + fileInfo[0] + ')'; // } else { - var fileInfo = getScriptOff(lineNumber); - data = msg + ' (' + fileInfo[1] + ': line ' + fileInfo[0] + ')'; + // var fileInfo = getScriptOff(lineNumber); + data = msg + ' (' + error.fileName + ': line ' + error.lineNumber + ')'; // } window.parent.postMessage([{ log: [{ @@ -434,23 +434,23 @@ window.onerror = function (msg, url, lineNumber, columnNo, error) { data: [data], id: Date.now().toString() }], - source: fileInfo[1] + source: error.fileName }], '*'); return false; }; // catch rejected promises window.onunhandledrejection = function (event) { if (event.reason && event.reason.message && event.reason.stack){ - var errorNum = event.reason.stack.split('about:srcdoc:')[1].split(':')[0]; - var fileInfo = getScriptOff(errorNum); - var data = event.reason.message + ' (' + fileInfo[1] + ': line ' + fileInfo[0] + ')'; + // var errorNum = event.reason.stack.split('about:srcdoc:')[1].split(':')[0]; + // var fileInfo = getScriptOff(errorNum); + var data = event.reason.message + ' (' + event.reason.stack + ': line ' + event.reason.stack.split("\n")[0] + ')'; window.parent.postMessage([{ log: [{ method: 'error', data: [data], id: Date.now().toString() }], - source: fileInfo[1] + source: event.reason.stack.split("\n")[0] }], '*'); } };