Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e9bee39

Browse filesBrowse files
jasnellMylesBorins
authored andcommitted
src: move node_contextify to modern THROW_ERR_*
Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: #35470 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent b741f2f commit e9bee39
Copy full SHA for e9bee39

File tree

Expand file treeCollapse file tree

2 files changed

+4
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+4
-1
lines changed
Open diff view settings
Collapse file

‎src/node_contextify.cc‎

Copy file name to clipboardExpand all lines: src/node_contextify.cc
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,8 @@ bool ContextifyScript::EvalMachine(Environment* env,
903903
if (!env->can_call_into_js())
904904
return false;
905905
if (!ContextifyScript::InstanceOf(env, args.Holder())) {
906-
env->ThrowTypeError(
906+
THROW_ERR_INVALID_THIS(
907+
env,
907908
"Script methods can only be called on script instances.");
908909
return false;
909910
}
Collapse file

‎src/node_errors.h‎

Copy file name to clipboardExpand all lines: src/node_errors.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ void OnFatalError(const char* location, const char* message);
4040
V(ERR_INVALID_ARG_VALUE, TypeError) \
4141
V(ERR_OSSL_EVP_INVALID_DIGEST, Error) \
4242
V(ERR_INVALID_ARG_TYPE, TypeError) \
43+
V(ERR_INVALID_THIS, TypeError) \
4344
V(ERR_INVALID_TRANSFER_OBJECT, TypeError) \
4445
V(ERR_MEMORY_ALLOCATION_FAILED, Error) \
4546
V(ERR_MESSAGE_TARGET_CONTEXT_UNAVAILABLE, Error) \
@@ -94,6 +95,7 @@ void OnFatalError(const char* location, const char* message);
9495
V(ERR_CRYPTO_UNKNOWN_DH_GROUP, "Unknown DH group") \
9596
V(ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE, \
9697
"Context not associated with Node.js environment") \
98+
V(ERR_INVALID_THIS, "Value of \"this\" is the wrong type") \
9799
V(ERR_INVALID_TRANSFER_OBJECT, "Found invalid object in transferList") \
98100
V(ERR_MEMORY_ALLOCATION_FAILED, "Failed to allocate memory") \
99101
V(ERR_OSSL_EVP_INVALID_DIGEST, "Invalid digest used") \

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.