mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-21 01:29:50 +00:00
Improve error logging for failed JS-to-C++ script conversions
Previously, if a JavaScript function returned a value that failed to convert to the requested C++ type (e.g., from JS undefined to std::wstring), the ScriptInterface would fail silently, making debugging difficult. This commit improves the error reporting in the script system by logging the name of the JavaScript function being called when a type conversion failure occurs. This makes it easier to trace and fix issues arising from script-side inconsistencies or missing return values. The improved logging is particularly useful for debugging errors such as undefined civ values from GetCiv() when used via m_Script.Call<T>().
This commit is contained in:
@@ -250,7 +250,7 @@ private:
|
||||
if constexpr (!std::is_same_v<R, IgnoreResult_t>)
|
||||
{
|
||||
if (success)
|
||||
Script::FromJSVal(rq, jsRet, ret);
|
||||
success = Script::FromJSVal(rq, jsRet, ret);
|
||||
}
|
||||
else
|
||||
UNUSED2(ret); // VS2017 complains.
|
||||
|
||||
Reference in New Issue
Block a user