Best debugging method in p5js/javascript

Hi, Debugging sketch for my students is not so easy ! So, I'd like to discuss about debugging best approach with interresting people.

Here my first bug sample:

I'd like to know how we can detect the error present in this sketch sample : https://openprocessing.org/sketch/473863 In this sketch I just replace the image attribute width to widht (A common error from my students) When we run the sketch , img2 is missing, but no error or warning messages from console.

Have any Ideas

Christophe

Tagged:

Comments

  • Well the lesson here is to not retrieve object properties directly but via a getter since getWidht() would throw an error ;)

    ...but p5.image sadly doesn't appear to include a getWidth method :/

    Actually I'd report this as a bug since p5.image() is failing silently when being passed invalid arguments - which as you've demonstrated leads to problems that are hard to debug...

Sign In or Register to comment.