Ask AI about errors - q5js/q5.js GitHub Wiki
JavaScript quietly avoids errors if possible (for example by giving undefined variables default values) and its error messages can be confusing for beginners.
So why doesn't your code work? You can ask AI!
function draw() {
askAI();
text('Hello!');
}
ChatGPT 4o excels at identifying the most common errors that beginners make: typos, missing syntax, incorrect arguments, and more.
This feature can be disabled by setting Q5.disableFriendlyErrors = true;
, though unlike in p5 this doesn't provide a performance boost from disabling argument validation because q5 mostly doesn't have any already.
q5 can catch errors in q5 function like draw
and continue looping if you set Q5.errorTolerant = true;
.