MCPcopy Create free account
hub / github.com/BabylonJS/BabylonNative / napi_throw_error

Function napi_throw_error

Dependencies/napi/source/js_native_api_v8.cc:1802–1819  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1800}
1801
1802napi_status napi_throw_error(napi_env env,
1803 const char* code,
1804 const char* msg) {
1805 NAPI_PREAMBLE(env);
1806
1807 v8::Isolate* isolate = env->isolate;
1808 v8::Local<v8::String> str;
1809 CHECK_NEW_FROM_UTF8(env, str, msg);
1810
1811 v8::Local<v8::Value> error_obj = v8::Exception::Error(str);
1812 napi_status status = set_error_code(env, error_obj, nullptr, code);
1813 if (status != napi_ok) return status;
1814
1815 isolate->ThrowException(error_obj);
1816 // any VM calls after this point and before returning
1817 // to the javascript invoker will fail
1818 return napi_clear_last_error(env);
1819}
1820
1821napi_status napi_throw_type_error(napi_env env,
1822 const char* code,

Callers

nothing calls this directly

Calls 3

ErrorClass · 0.85
set_error_codeFunction · 0.85
napi_clear_last_errorFunction · 0.70

Tested by

no test coverage detected