Skip to content

Commit 7946910

Browse files
joyeecheungjasnell
authored andcommitted
src: throw ERR_MISSING_MODULE in module_wrap.cc
PR-URL: #20121 Reviewed-By: Daniel Bevenius <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]>
1 parent 02db891 commit 7946910

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/module_wrap.cc

+1-2
Original file line numberDiff line numberDiff line change
@@ -685,8 +685,7 @@ void ModuleWrap::Resolve(const FunctionCallbackInfo<Value>& args) {
685685
Maybe<URL> result = node::loader::Resolve(env, specifier_std, url);
686686
if (result.IsNothing() || (result.FromJust().flags() & URL_FLAGS_FAILED)) {
687687
std::string msg = "Cannot find module " + specifier_std;
688-
env->ThrowError(msg.c_str());
689-
return;
688+
return node::THROW_ERR_MISSING_MODULE(env, msg.c_str());
690689
}
691690

692691
args.GetReturnValue().Set(result.FromJust().ToObject(env));

src/node_errors.h

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ namespace node {
2121
V(ERR_INDEX_OUT_OF_RANGE, RangeError) \
2222
V(ERR_INVALID_ARG_TYPE, TypeError) \
2323
V(ERR_MEMORY_ALLOCATION_FAILED, Error) \
24+
V(ERR_MISSING_MODULE, Error) \
2425
V(ERR_STRING_TOO_LONG, Error) \
2526
V(ERR_BUFFER_TOO_LARGE, Error)
2627

0 commit comments

Comments
 (0)