diff --git a/src/image/loading_displaying.js b/src/image/loading_displaying.js index f257b2a0d3..53150839ce 100644 --- a/src/image/loading_displaying.js +++ b/src/image/loading_displaying.js @@ -143,10 +143,10 @@ p5.prototype.loadImage = function(path, successCallback, failureCallback) { e => { if (typeof failureCallback === 'function') { failureCallback(e); - self._decrementPreload(); } else { console.error(e); } + self._decrementPreload(); } ); } else { @@ -170,10 +170,10 @@ p5.prototype.loadImage = function(path, successCallback, failureCallback) { p5._friendlyFileLoadError(0, img.src); if (typeof failureCallback === 'function') { failureCallback(e); - self._decrementPreload(); } else { console.error(e); } + self._decrementPreload(); }; // Set crossOrigin in case image is served with CORS headers. @@ -193,10 +193,10 @@ p5.prototype.loadImage = function(path, successCallback, failureCallback) { p5._friendlyFileLoadError(0, path); if (typeof failureCallback === 'function') { failureCallback(e); - self._decrementPreload(); } else { console.error(e); } + self._decrementPreload(); }); return pImg; }; diff --git a/src/io/files.js b/src/io/files.js index 88d627b25a..6ea1f9b5f7 100644 --- a/src/io/files.js +++ b/src/io/files.js @@ -298,8 +298,9 @@ p5.prototype.loadJSON = function(...args) { if (errorCallback) { errorCallback(err); } else { - throw err; + console.error(err); } + self._decrementPreload(); } ); @@ -494,8 +495,9 @@ p5.prototype.loadStrings = function(...args) { if (errorCallback) { errorCallback(err); } else { - throw err; + console.error(err); } + self._decrementPreload(); } ); @@ -757,6 +759,7 @@ p5.prototype.loadTable = function(path) { } else { console.error(err); } + self._decrementPreload(); } ); @@ -975,8 +978,9 @@ p5.prototype.loadXML = function(...args) { if (errorCallback) { errorCallback(err); } else { - throw err; + console.error(err); } + self._decrementPreload(); } ); @@ -1033,8 +1037,9 @@ p5.prototype.loadBytes = function(file, callback, errorCallback) { if (errorCallback) { errorCallback(err); } else { - throw err; + console.error(err); } + self._decrementPreload(); } ); return ret; diff --git a/src/typography/loading_displaying.js b/src/typography/loading_displaying.js index f625db3d99..32f29c9d15 100644 --- a/src/typography/loading_displaying.js +++ b/src/typography/loading_displaying.js @@ -135,9 +135,11 @@ p5.prototype.loadFont = function(path, onSuccess, onError) { if (err) { p5._friendlyFileLoadError(4, path); if (typeof onError !== 'undefined') { - return onError(err); + onError(err); + } else { + console.error(err, path); } - console.error(err, path); + self._decrementPreload(); return; } diff --git a/src/webgl/loading.js b/src/webgl/loading.js index 9e22824da4..5beb53bda0 100755 --- a/src/webgl/loading.js +++ b/src/webgl/loading.js @@ -498,6 +498,7 @@ p5.prototype.loadModel = function(path,options) { 'Sorry, the file type is invalid. Only OBJ and STL files are supported.' ); } + self._decrementPreload(); } return model; };