Skip to content

BF: Silence unnecessary "ERROR" log in Polygon#7091

Merged
TEParsons merged 1 commit intopsychopy:devfrom
TEParsons:dev-bf-polygon-err
Feb 7, 2025
Merged

BF: Silence unnecessary "ERROR" log in Polygon#7091
TEParsons merged 1 commit intopsychopy:devfrom
TEParsons:dev-bf-polygon-err

Conversation

@TEParsons
Copy link
Copy Markdown
Contributor

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.Color object 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.

@codecov
Copy link
Copy Markdown

codecov bot commented Feb 7, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.99%. Comparing base (361486b) to head (9a572ce).
Report is 21 commits behind head on dev.

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     
Components Coverage Δ
app ∅ <ø> (∅)
boilerplate ∅ <ø> (∅)
library ∅ <ø> (∅)
vm-safe library ∅ <ø> (∅)

@TEParsons TEParsons merged commit 3564462 into psychopy:dev Feb 7, 2025
7 checks passed
@TEParsons TEParsons deleted the dev-bf-polygon-err branch February 12, 2025 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant