napi_create_error
NAPI_EXTERN napi_status napi_create_error(napi_env env,
napi_value code,
napi_value msg,
napi_value* result);
-
[in] env
:调用 API 的环境。¥
[in] env
: The environment that the API is invoked under. -
[in] code
:可选的napi_value
,带有与错误关联的错误代码的字符串。¥
[in] code
: Optionalnapi_value
with the string for the error code to be associated with the error. -
[in] msg
:napi_value
引用 JavaScriptstring
用作Error
的消息。¥
[in] msg
:napi_value
that references a JavaScriptstring
to be used as the message for theError
. -
[out] result
:napi_value
表示创建的错误。¥
[out] result
:napi_value
representing the error created.
如果 API 成功,则返回 napi_ok
。
¥Returns napi_ok
if the API succeeded.
此 API 返回带有所提供文本的 JavaScript Error
。
¥This API returns a JavaScript Error
with the text provided.