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:
parent
0881583535
commit
6ea44f6fb4
@ -0,0 +1 @@
|
||||
Promise.reject(new Error("message"));
|
@ -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();
|
||||
|
Loading…
Reference in New Issue
Block a user