| 1800 | } |
| 1801 | |
| 1802 | napi_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 | |
| 1821 | napi_status napi_throw_type_error(napi_env env, |
| 1822 | const char* code, |
nothing calls this directly
no test coverage detected