Make it clear where the warning is coming from when we try to convert a non-object to CColor.
Details
Agree with the improved string.
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
Event Timeline
Build failure - The Moirai have given mortals hearts that can endure.
Link to build: https://jenkins.wildfiregames.com/job/macos-differential/886/display/redirect
Build failure - The Moirai have given mortals hearts that can endure.
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2284/display/redirect
The mac build failiure in unrelated. Itms disabled Mac SVN build until he has some time to address the bug. Linux one is the usual segfault.
Make it clear where the warning is coming from when we try to convert a non-object to CColor.
It's the purpose of the JS stack to indicate where it's coming from. That only fails to indicate it when there are multiple FromJSVal<CColor> calls in the same line I suppose?
So I wonder how the error could be triggered to begin with and whether there is a stack at all. (FAIL function includes JS_ReportError but I've seen implementations that made the error reporter go silent).
I tried Engine.GetGUIObjectByName("gameDescription").textcolor=X; with X in { r: 33, g: 44, b: 55, a:0 }, 42and "11 22 33" .
I only got:
ERROR: JavaScript error: gui/gamesetup/gamesetup.js line 44 TypeError: invalid arguments ERROR: GUI page 'page_gamesetup.xml': Failed to call init() function
That string seems to be generic from SM https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Typed_array_invalid_arguments
So for this specific way to trigger a invalid-color-argument warning, we get a JS stack which is good. But I don't see the changed string that could enable developers to see which object assignment in that line failed.
The only explicit call to FromJSVal<CColor> I find with a grep for this string is an occurrence in CGUISetting.cpp which should be the aforementioned way to trigger the warning.
Looking at that code, it seems the ctextobject.textcolor=33 assignment should trigger the error but doesn't?
Searching for FromJSVal( indicates Scripting/JSInterface_IGUIObject.cpp, but that shold be the same code path as mentioned above.
Scripting/GuiScriptConversions.cpp path is only triggered for XML files, is that the way the changed string can be triggered?
(tests/test_GuiManager.h and SettingTypes/CGUISize.cpp seem unrelated, so I don't find another way to trigger the message with the limited timeeffort I spent.)
As you changed this specific string, I suppose you found a way to trigger that string and were unsatisfied with the string, so it should be possible to mention how it can be triggered without disproportionate effort?