mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
src: throw ERR_MISSING_MODULE in module_wrap.cc
PR-URL: https://github.com/nodejs/node/pull/20121 Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
This commit is contained in:
parent
8b1b36bfc5
commit
02dc307ae2
@ -685,8 +685,7 @@ void ModuleWrap::Resolve(const FunctionCallbackInfo<Value>& args) {
|
||||
Maybe<URL> result = node::loader::Resolve(env, specifier_std, url);
|
||||
if (result.IsNothing() || (result.FromJust().flags() & URL_FLAGS_FAILED)) {
|
||||
std::string msg = "Cannot find module " + specifier_std;
|
||||
env->ThrowError(msg.c_str());
|
||||
return;
|
||||
return node::THROW_ERR_MISSING_MODULE(env, msg.c_str());
|
||||
}
|
||||
|
||||
args.GetReturnValue().Set(result.FromJust().ToObject(env));
|
||||
|
@ -21,6 +21,7 @@ namespace node {
|
||||
V(ERR_INDEX_OUT_OF_RANGE, RangeError) \
|
||||
V(ERR_INVALID_ARG_TYPE, TypeError) \
|
||||
V(ERR_MEMORY_ALLOCATION_FAILED, Error) \
|
||||
V(ERR_MISSING_MODULE, Error) \
|
||||
V(ERR_STRING_TOO_LONG, Error) \
|
||||
V(ERR_BUFFER_TOO_LARGE, Error)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user