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_valuewith the string for the error code to be associated with the error. -
[in] msg:napi_value引用 JavaScriptstring用作Error的消息。¥
[in] msg:napi_valuethat references a JavaScriptstringto be used as the message for theError. -
[out] result:napi_value表示创建的错误。¥
[out] result:napi_valuerepresenting 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.