NAPI_EXTERN napi_status napi_create_type_error(napi_env env,
napi_value code,
napi_value msg,
napi_value* result);
[in] env
: The environment that the API is invoked under.[in] code
: Optionalnapi_value
with the string for the error code to be associated with the error.[in] msg
:napi_value
that references a JavaScriptString
to be used as the message for theError
.[out] result
:napi_value
representing the error created.
Returns napi_ok
if the API succeeded.
This API returns a JavaScript TypeError
with the text provided.