mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-09-21 20:06:40 +00:00
Improve JS Exception handling.
- Check for pending exceptions after function calls and script executions. - Call LOGERROR instead of JS_ReportError when there is a conversion error in FromJSVal, since that can only be called from C++ (where JS errors don't really make sense). Instead, C++ callers of FromJSVal should handle the failure and, themselves, either report an error or simply do something else. - Wrap JS_ReportError since that makes updating it later easier. This isn't a systematical fix since ToJSVal also ought return a boolean for failures, and we probably should trigger errors instead of warnings on 'implicit' conversions, rather a preparation diff. Part of the SM52 migration, stage: SM45 compatible (actually SM52 incompatible, too). Based on a patch by: Itms Comments by: Vladislavbelov, Stan` Refs #742, #4893 Differential Revision: https://code.wildfiregames.com/D3093 This was SVN commit r24187.
This commit is contained in:
@@ -371,7 +371,7 @@ PSRETURN CMapSummaryReader::LoadMap(const VfsPath& pathname)
|
||||
|
||||
void CMapSummaryReader::GetMapSettings(const ScriptInterface& scriptInterface, JS::MutableHandleValue ret)
|
||||
{
|
||||
ScriptInterface::Request rq(scriptInterface);
|
||||
ScriptRequest rq(scriptInterface);
|
||||
|
||||
ScriptInterface::CreateObject(rq, ret);
|
||||
|
||||
@@ -1266,7 +1266,7 @@ int CMapReader::LoadRMSettings()
|
||||
|
||||
int CMapReader::GenerateMap()
|
||||
{
|
||||
ScriptInterface::Request rq(pSimulation2->GetScriptInterface());
|
||||
ScriptRequest rq(pSimulation2->GetScriptInterface());
|
||||
|
||||
if (!m_MapGen)
|
||||
{
|
||||
@@ -1328,7 +1328,7 @@ int CMapReader::GenerateMap()
|
||||
int CMapReader::ParseTerrain()
|
||||
{
|
||||
TIMER(L"ParseTerrain");
|
||||
ScriptInterface::Request rq(pSimulation2->GetScriptInterface());
|
||||
ScriptRequest rq(pSimulation2->GetScriptInterface());
|
||||
|
||||
// parse terrain from map data
|
||||
// an error here should stop the loading process
|
||||
@@ -1403,7 +1403,7 @@ int CMapReader::ParseTerrain()
|
||||
int CMapReader::ParseEntities()
|
||||
{
|
||||
TIMER(L"ParseEntities");
|
||||
ScriptInterface::Request rq(pSimulation2->GetScriptInterface());
|
||||
ScriptRequest rq(pSimulation2->GetScriptInterface());
|
||||
|
||||
// parse entities from map data
|
||||
std::vector<Entity> entities;
|
||||
@@ -1467,7 +1467,7 @@ int CMapReader::ParseEntities()
|
||||
int CMapReader::ParseEnvironment()
|
||||
{
|
||||
// parse environment settings from map data
|
||||
ScriptInterface::Request rq(pSimulation2->GetScriptInterface());
|
||||
ScriptRequest rq(pSimulation2->GetScriptInterface());
|
||||
|
||||
#define GET_ENVIRONMENT_PROPERTY(val, prop, out)\
|
||||
if (!pSimulation2->GetScriptInterface().GetProperty(val, #prop, out))\
|
||||
@@ -1566,7 +1566,7 @@ int CMapReader::ParseEnvironment()
|
||||
|
||||
int CMapReader::ParseCamera()
|
||||
{
|
||||
ScriptInterface::Request rq(pSimulation2->GetScriptInterface());
|
||||
ScriptRequest rq(pSimulation2->GetScriptInterface());
|
||||
|
||||
// parse camera settings from map data
|
||||
// defaults if we don't find player starting camera
|
||||
|
||||
Reference in New Issue
Block a user