Fix Show actual type in strands hook error messages by Anshumancanrock · Pull Request #8505 · processing/p5.js

@Anshumancanrock

Resolves #8444

Changes:

  • Fixed bug: retNode.baseTypereturnedNode.baseType (was causing "undefined" instead of actual type)
  • Error messages now show the actual returned type (e.g., "vec4" instead of "undefined")
  • Struct mismatch error now lists expected properties so users know what the struct contains
  • Added guidance explaining users should modify and return the input struct
  • Improved incomplete struct error to show expected vs received properties

PR Checklist

davepagurek

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this on! Would you be able to add some unit tests for this? A strategy could be to spy on FES.userError (search for spy in the tests directory for examples) and assert that it was called with the expected message.

@Anshumancanrock

@Anshumancanrock

@Anshumancanrock

@davepagurek Done! Added unit tests with vi.mock on strands_FES , covers all three error paths (wrong type in struct hook, vector dimension mismatch, incomplete struct).

Please take a look and let me know if you would like any changes. Thanks !

@davepagurek

davepagurek

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks!