GeezerVison is showing github.com — src: move node_contextify to modern THROW_ERR_* · subson/node@eb322bb
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
Copy file name to clipboardExpand all lines: src/node_contextify.cc +2-1Lines changed: 2 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -927,7 +927,8 @@ bool ContextifyScript::EvalMachine(Environment* env, |
927 | 927 | if (!env->can_call_into_js()) |
928 | 928 | return false; |
929 | 929 | if (!ContextifyScript::InstanceOf(env, args.Holder())) { |
930 | | - env->ThrowTypeError( |
| 930 | + THROW_ERR_INVALID_THIS( |
| 931 | + env, |
931 | 932 | "Script methods can only be called on script instances."); |
932 | 933 | return false; |
933 | 934 | } |
|
Collapse file
Copy file name to clipboardExpand all lines: src/node_errors.h +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -57,6 +57,7 @@ void OnFatalError(const char* location, const char* message); |
57 | 57 | V(ERR_INVALID_ARG_VALUE, TypeError) \ |
58 | 58 | V(ERR_OSSL_EVP_INVALID_DIGEST, Error) \ |
59 | 59 | V(ERR_INVALID_ARG_TYPE, TypeError) \ |
| 60 | + V(ERR_INVALID_THIS, TypeError) \ |
60 | 61 | V(ERR_INVALID_TRANSFER_OBJECT, TypeError) \ |
61 | 62 | V(ERR_MEMORY_ALLOCATION_FAILED, Error) \ |
62 | 63 | V(ERR_MESSAGE_TARGET_CONTEXT_UNAVAILABLE, Error) \ |
@@ -129,6 +130,7 @@ void OnFatalError(const char* location, const char* message); |
129 | 130 | V(ERR_CRYPTO_JOB_INIT_FAILED, "Failed to initialize crypto job config") \ |
130 | 131 | V(ERR_EXECUTION_ENVIRONMENT_NOT_AVAILABLE, \ |
131 | 132 | "Context not associated with Node.js environment") \ |
| 133 | + V(ERR_INVALID_THIS, "Value of \"this\" is the wrong type") \ |
132 | 134 | V(ERR_INVALID_TRANSFER_OBJECT, "Found invalid object in transferList") \ |
133 | 135 | V(ERR_MEMORY_ALLOCATION_FAILED, "Failed to allocate memory") \ |
134 | 136 | V(ERR_OSSL_EVP_INVALID_DIGEST, "Invalid digest used") \ |
|