BF: Silence unnecessary "ERROR" log in Polygon#7091
Merged
TEParsons merged 1 commit intopsychopy:devfrom Feb 7, 2025
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## dev #7091 +/- ##
==========================================
+ Coverage 49.97% 49.99% +0.02%
==========================================
Files 347 347
Lines 64084 64056 -28
==========================================
- Hits 32027 32026 -1
+ Misses 32057 32030 -27
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The crux of the problem was that (as of #6865) the init param for Polygon's fill and line colors had a value which was already translated to JS. It needs to be so as the JS transpiler can't detect a color from just the value given (how would it know the difference between $[1, 1, 1] being white in RGB vs being an array of three 1s?), but setting the value here meant that when the param was stringified it was translated again. Doing so wasn't harmful to the output as, upon failing, it returned the value unchanged, but when it fails it logs a confusing error message.
This PR fixes this by, rather than setting the value of the param to be the translated string, replaces the param with a simple string.
In the long term, we should really make the various color attributes of PsychoJS objects create their own
util.Colorobject when set (like how the equivalent objects work in PsychoPy), so that this translation isn't needed. But for now, this silences the error without changing the output.