-
-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FES: Add detection for trailing undefined arguments #4606
FES: Add detection for trailing undefined arguments #4606
Conversation
1. Add tests for the edge cases in processing#2740 2. Pass errorType to ValidationError constructor so that it could be accessed in the tests 3. Add tests for trailing undefined arguments
Codecov Report
@@ Coverage Diff @@
## master #4606 +/- ##
=======================================
Coverage 67.73% 67.74%
=======================================
Files 73 73
Lines 11416 11420 +4
Branches 2442 2443 +1
=======================================
+ Hits 7733 7736 +3
- Misses 3683 3684 +1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @akshay-99. Thank you!
Hm - tests passed on this PR before but after merge we are failing on the EDIT: Ah yes, now I am remembering that the examples for |
The ones for |
Whoops looks like @lmccart already fixed it. Thanks! 😄 |
oh sorry I missed this thread! |
Resolves #4571
Changes:
Consider the following few examples
Here g and b are undefined. But earlier as color with only one argument was still a valid overload, the FES did not log a message. But as it is passed 3 arguments, it is likely that them being undefined is unintentional and so a message should be displayed.
Now it shows:
🌸 p5.js says: color() was expecting Number for parameter #1 (zero-based index), received an empty variable instead
🌸 p5.js says: color() was expecting Number for parameter #2 (zero-based index), received an empty variable instead
Similarly:
would not have logged an error before this, as the undefined argument is trailing and select(string) is a valid overload. A message here is important to let the user know that
a
is empty ( i.enotexistant
was not found )Now it shows:
🌸 p5.js says: select() was expecting String|p5.Element|HTMLElement for parameter #1 (zero-based index), received an empty variable instead.
Also for
Earlier we used to get
🌸 p5.js says: circle() was expecting at least 3 arguments, but received only 2
Now it correctly shows:
🌸 p5.js says: circle() was expecting Number for parameter #2 (zero-based index), received an empty variable instead.
PR Checklist
npm run lint
passes