improve error handling and logging
This commit is contained in:
parent
aa2d324cab
commit
a6594f142b
1 changed files with 4 additions and 2 deletions
6
dist/static/assets/webcam.js
vendored
6
dist/static/assets/webcam.js
vendored
|
@ -458,16 +458,18 @@ 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 () {
|
||||||
|
oldLog.apply(console, arguments);
|
||||||
|
|
||||||
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
|
||||||
window.parent.postMessage([{
|
window.parent.postMessage([{
|
||||||
log: [{
|
log: [{
|
||||||
method: 'log',
|
method: 'log',
|
||||||
data: arguments,
|
data: args,
|
||||||
id: Date.now().toString()
|
id: Date.now().toString()
|
||||||
}],
|
}],
|
||||||
source: logSrc
|
source: logSrc
|
||||||
}], '*');
|
}], '*');
|
||||||
oldLog.apply(console, arguments);
|
|
||||||
};
|
};
|
||||||
})();
|
})();
|
Loading…
Reference in a new issue