Fix Show actual type in strands hook error messages by Anshumancanrock · Pull Request #8505 · processing/p5.js
Resolves #8444
Changes:
- Fixed bug:
retNode.baseType→returnedNode.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
-
npm run lintpasses - Inline reference is included / updated
- Unit tests are included / updated
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.
@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 !
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters