improve error handling and logging

This commit is contained in:
Ruben van de Ven 2020-09-28 11:29:45 +02:00
parent a6594f142b
commit cebfae6430

View file

@ -457,12 +457,12 @@ if (event.reason && event.reason.message && event.reason.stack){
(function(){ (function(){
const oldLog = console.log; const oldLog = console.log;
console.log = function () { console.log = function (...params) {
oldLog.apply(console, arguments); oldLog.apply(console, params);
const err = new Error(); const err = new Error();
const logSrc = err.stack.split("\n")[1]; const logSrc = err.stack.split("\n")[1];
const args = arguments.map((a) => ""+a); // to string const args = params.map((a) => ""+a); // to string
window.parent.postMessage([{ window.parent.postMessage([{
log: [{ log: [{
method: 'log', method: 'log',