From a6594f142badac9f4b9125ff3487cd33499d7910 Mon Sep 17 00:00:00 2001 From: Ruben van de Ven Date: Mon, 28 Sep 2020 11:27:03 +0200 Subject: [PATCH] improve error handling and logging --- dist/static/assets/webcam.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dist/static/assets/webcam.js b/dist/static/assets/webcam.js index 07c5fa1c..c8988d0a 100644 --- a/dist/static/assets/webcam.js +++ b/dist/static/assets/webcam.js @@ -458,16 +458,18 @@ if (event.reason && event.reason.message && event.reason.stack){ (function(){ const oldLog = console.log; console.log = function () { + oldLog.apply(console, arguments); + const err = new Error(); const logSrc = err.stack.split("\n")[1]; + const args = arguments.map((a) => ""+a); // to string window.parent.postMessage([{ log: [{ method: 'log', - data: arguments, + data: args, id: Date.now().toString() }], source: logSrc }], '*'); - oldLog.apply(console, arguments); }; })(); \ No newline at end of file