From b62930f22b72ce126a489434c2e7ac10d3c4ae8b Mon Sep 17 00:00:00 2001 From: Chenxu He Date: Thu, 20 Apr 2023 10:12:51 -0700 Subject: [PATCH] [FES] Replace console.error with FES --- src/webgl/loading.js | 2 +- src/webgl/p5.Matrix.js | 2 +- src/webgl/p5.RendererGL.js | 4 ++-- src/webgl/p5.Shader.js | 6 +++--- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/webgl/loading.js b/src/webgl/loading.js index 039eba7fea..e0a083799d 100755 --- a/src/webgl/loading.js +++ b/src/webgl/loading.js @@ -170,7 +170,7 @@ p5.prototype.loadModel = function(path) { if (failureCallback) { failureCallback(); } else { - console.error( + p5._friendlyError( 'Sorry, the file type is invalid. Only OBJ and STL files are supported.' ); } diff --git a/src/webgl/p5.Matrix.js b/src/webgl/p5.Matrix.js index 9b575b3109..e8bc4b543a 100644 --- a/src/webgl/p5.Matrix.js +++ b/src/webgl/p5.Matrix.js @@ -349,7 +349,7 @@ p5.Matrix = class { */ inverseTranspose(matrix) { if (this.mat3 === undefined) { - console.error('sorry, this function only works with mat3'); + p5._friendlyError('sorry, this function only works with mat3'); } else { //convert mat4 -> mat3 this.mat3[0] = matrix.mat4[0]; diff --git a/src/webgl/p5.RendererGL.js b/src/webgl/p5.RendererGL.js index 5c26a0e832..d1ce436228 100644 --- a/src/webgl/p5.RendererGL.js +++ b/src/webgl/p5.RendererGL.js @@ -579,7 +579,7 @@ p5.prototype.setAttributes = function(key, value) { if (!this._setupDone) { for (const x in this._renderer.retainedMode.geometry) { if (this._renderer.retainedMode.geometry.hasOwnProperty(x)) { - console.error( + p5._friendlyError( 'Sorry, Could not set the attributes, you need to call setAttributes() ' + 'before calling the other drawing methods in setup()' ); @@ -755,7 +755,7 @@ p5.RendererGL.prototype.filter = function(filterType) { // filter can be achieved using custom shaders. // https://github.com/aferriss/p5jsShaderExamples // https://itp-xstory.github.io/p5js-shaders/#/ - console.error('filter() does not work in WEBGL mode'); + p5._friendlyError('filter() does not work in WEBGL mode'); }; p5.RendererGL.prototype.blendMode = function(mode) { diff --git a/src/webgl/p5.Shader.js b/src/webgl/p5.Shader.js index 2a6c832a7b..ac4bf11bf2 100644 --- a/src/webgl/p5.Shader.js +++ b/src/webgl/p5.Shader.js @@ -63,7 +63,7 @@ p5.Shader = class { gl.compileShader(this._vertShader); // if our vertex shader failed compilation? if (!gl.getShaderParameter(this._vertShader, gl.COMPILE_STATUS)) { - console.error( + p5._friendlyError( `Yikes! An error occurred compiling the vertex shader:${gl.getShaderInfoLog( this._vertShader )}` @@ -77,7 +77,7 @@ p5.Shader = class { gl.compileShader(this._fragShader); // if our frag shader failed compilation? if (!gl.getShaderParameter(this._fragShader, gl.COMPILE_STATUS)) { - console.error( + p5._friendlyError( `Darn! An error occurred compiling the fragment shader:${gl.getShaderInfoLog( this._fragShader )}` @@ -90,7 +90,7 @@ p5.Shader = class { gl.attachShader(this._glProgram, this._fragShader); gl.linkProgram(this._glProgram); if (!gl.getProgramParameter(this._glProgram, gl.LINK_STATUS)) { - console.error( + p5._friendlyError( `Snap! Error linking shader program: ${gl.getProgramInfoLog( this._glProgram )}`