processing / p5.js

p5.js is a client-side JS platform that empowers artists, designers, students, and anyone to learn to code and express themselves creatively on the web. It is based on the core principles of Processing. http://twitter.com/p5xjs —
http://p5js.org/
GNU Lesser General Public License v2.1
21.66k stars 3.32k forks source link

Error when using loadJSON should catch error and not stop the process if there is an errorCallback #5292

Open dievardump opened 3 years ago

dievardump commented 3 years ago

Most appropriate sub-area of p5.js?

Details about the bug:

function preload() { const uri = 'unknown.json';

function onLoad(data) { meta.metadata = data; }

function onError(error) { console.log(error); }

loadJSON(uri, onLoad, onError); }

function setup() { createcanvas(windowWidth, windowHeight); fill(255); rect(0, 0, 250, 250); }


I am trying to fetch a file. This file can be present or not, therefore I have default data already set. 

Since I provide an `onError` callback, It explicitly means that I wish to handle the error myself. I expect the error to be catched and passed to the onError callback, without stopping the current process.

However, here, the error is passed to onError but is not catched, so it propagates and stop everything from working.
limzykenneth commented 3 years ago

Possibly related to #5032

chepecarlos commented 1 year ago

same error in version 1.6.0