forked from ClearFoundry/ClearScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathV8Exception.cpp
More file actions
30 lines (24 loc) · 1.43 KB
/
Copy pathV8Exception.cpp
File metadata and controls
30 lines (24 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT license.
#include "ClearScriptV8Managed.h"
//-----------------------------------------------------------------------------
// V8Exception implementation
//-----------------------------------------------------------------------------
void DECLSPEC_NORETURN V8Exception::ThrowScriptEngineException() const
{
auto gcEngineName = m_EngineName.ToManagedString();
auto gcMessage = m_Message.ToManagedString();
auto gcStackTrace = m_StackTrace.ToManagedString();
auto gcEngine = ScriptEngine::Current;
auto gcScriptException = (gcEngine != nullptr) ? gcEngine->MarshalToHost(V8ContextProxyImpl::ExportValue(m_ScriptException), false) : nullptr;
auto gcInnerException = V8ProxyHelpers::MarshalExceptionToHost(V8ContextProxyImpl::ExportValue(m_InnerException));
switch (m_Type)
{
case Type::General: default:
throw gcnew ScriptEngineException(gcEngineName, gcMessage, gcStackTrace, 0, false, m_ExecutionStarted, gcScriptException, gcInnerException);
case Type::Fatal:
throw gcnew ScriptEngineException(gcEngineName, gcMessage, gcStackTrace, 0, true, m_ExecutionStarted, gcScriptException, gcInnerException);
case Type::Interrupt:
throw gcnew ScriptInterruptedException(gcEngineName, gcMessage, gcStackTrace, 0, false, m_ExecutionStarted, gcScriptException, gcInnerException);
}
}