improve error handling and logging

This commit is contained in:
Ruben van de Ven 2020-09-28 12:17:32 +02:00
parent 27b4eea796
commit f1a60d4dee

View file

@ -1,6 +1,6 @@
console.log('p5 version:', p5); // console.log('p5 version:', p5);
console.log('ml5 version:', ml5); // console.log('ml5 version:', ml5);
console.log(location.origin); // console.log(location.origin);
let assets = {}; let assets = {};
@ -20,7 +20,7 @@ var draw = function () {
try { try {
drawMask(transformed); drawMask(transformed);
} catch (error) { } catch (error) {
console.exception(error); console.error(error);
} }
pop(); pop();
@ -146,7 +146,7 @@ function setup() {
video = createCapture(constraints); video = createCapture(constraints);
lastFrame = createGraphics(video.width, video.height); lastFrame = createGraphics(video.width, video.height);
console.log(video); // console.log(video);
// HeadGazeSetup(video); // HeadGazeSetup(video);
// video.size(width, height); // video.size(width, height);
video.hide(); // Hide the video element, and just show the canvas video.hide(); // Hide the video element, and just show the canvas
@ -169,7 +169,7 @@ var handleResults = function(){
gotResults = function(err, result) { gotResults = function(err, result) {
if (err) { if (err) {
console.log(err) console.error(err)
return return
} }
@ -179,7 +179,7 @@ gotResults = function(err, result) {
// size of video becomes known only after camera approval // size of video becomes known only after camera approval
if(lastFrame.width != video.width || lastFrame.height != video.height){ if(lastFrame.width != video.width || lastFrame.height != video.height){
console.log('Resizing canvas'); // console.log('Resizing canvas');
lastFrame.resizeCanvas(video.width, video.height); lastFrame.resizeCanvas(video.width, video.height);
} }