improve error handling and logging
This commit is contained in:
parent
cebfae6430
commit
27b4eea796
2 changed files with 1 additions and 19 deletions
|
@ -15,6 +15,7 @@ const defaultHTML =
|
|||
<head>
|
||||
<script src="/assets/p5.js"></script>
|
||||
<script src="/assets/ml5.js"></script>
|
||||
<script src="/previewScripts.js"></script>
|
||||
<script src="/assets/webcam.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="style.css">
|
||||
<meta charset="utf-8" />
|
||||
|
|
19
dist/static/assets/webcam.js
vendored
19
dist/static/assets/webcam.js
vendored
|
@ -454,22 +454,3 @@ if (event.reason && event.reason.message && event.reason.stack){
|
|||
}], '*');
|
||||
}
|
||||
};
|
||||
|
||||
(function(){
|
||||
const oldLog = console.log;
|
||||
console.log = function (...params) {
|
||||
oldLog.apply(console, params);
|
||||
|
||||
const err = new Error();
|
||||
const logSrc = err.stack.split("\n")[1];
|
||||
const args = params.map((a) => ""+a); // to string
|
||||
window.parent.postMessage([{
|
||||
log: [{
|
||||
method: 'log',
|
||||
data: args,
|
||||
id: Date.now().toString()
|
||||
}],
|
||||
source: logSrc
|
||||
}], '*');
|
||||
};
|
||||
})();
|
Loading…
Reference in a new issue