1
0
forked from mirrors/0ad

Log rejected promises

Forgoten in f9114a87f2

Comments by: @Stan
Differential Revision: https://code.wildfiregames.com/D5305
This was SVN commit r28155.
This commit is contained in:
phosit
2024-07-22 08:40:33 +00:00
parent 0881583535
commit 6ea44f6fb4
3 changed files with 11 additions and 0 deletions
+1
View File
@@ -132,6 +132,7 @@ ScriptContext::ScriptContext(int contextSize, int heapGrowthBytesGCTrigger):
ScriptEngine::GetSingleton().RegisterContext(m_cx);
JS::SetJobQueue(m_cx, m_JobQueue.get());
JS::SetPromiseRejectionTrackerCallback(m_cx, &Script::UnhandledRejectedPromise);
}
ScriptContext::~ScriptContext()
@@ -42,6 +42,15 @@ public:
ScriptFunction::CallVoid(rq, global, "endTest");
}
void test_exception()
{
ScriptInterface script("Engine", "Test", g_ScriptContext);
TestLogger logger;
TS_ASSERT(script.LoadGlobalScriptFile(L"promises/reject.js"));
TS_ASSERT_STR_CONTAINS(logger.GetOutput(),
"An unhandled promise got rejected:\nError: message");
}
void setUp()
{
g_VFS = CreateVfs();