Skip to content

Commit

Permalink
src: move node_contextify to modern THROW_ERR_*
Browse files Browse the repository at this point in the history
Signed-off-by: James M Snell <jasnell@gmail.com>

PR-URL: #35470
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
  • Loading branch information
jasnell committed Oct 10, 2020
1 parent b28ba4b commit eb322bb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/node_contextify.cc
Expand Up @@ -927,7 +927,8 @@ bool ContextifyScript::EvalMachine(Environment* env,
if (!env->can_call_into_js())
return false;
if (!ContextifyScript::InstanceOf(env, args.Holder())) {
env->ThrowTypeError(
THROW_ERR_INVALID_THIS(
env,
"Script methods can only be called on script instances.");
return false;
}
Expand Down
2 changes: 2 additions & 0 deletions src/node_errors.h
Expand Up @@ -57,6 +57,7 @@ void OnFatalError(const char* location, const char* message);
V(ERR_INVALID_ARG_VALUE, TypeError) \
V(ERR_OSSL_EVP_INVALID_DIGEST, Error) \
V(ERR_INVALID_ARG_TYPE, TypeError) \
V(ERR_INVALID_THIS, TypeError) \
V(ERR_INVALID_TRANSFER_OBJECT, TypeError) \
V(ERR_MEMORY_ALLOCATION_FAILED, Error) \
V(ERR_MESSAGE_TARGET_CONTEXT_UNAVAILABLE, Error) \
Expand Down Expand Up @@ -129,6 +130,7 @@ void OnFatalError(const char* location, const char* message);
V(ERR_CRYPTO_JOB_INIT_FAILED, "Failed to initialize crypto job config") \
V(ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE, \
"Context not associated with Node.js environment") \
V(ERR_INVALID_THIS, "Value of \"this\" is the wrong type") \
V(ERR_INVALID_TRANSFER_OBJECT, "Found invalid object in transferList") \
V(ERR_MEMORY_ALLOCATION_FAILED, "Failed to allocate memory") \
V(ERR_OSSL_EVP_INVALID_DIGEST, "Invalid digest used") \
Expand Down

0 comments on commit eb322bb

Please sign in to comment.