Skip to content

Commit

Permalink
src: throw ERR_MISSING_MODULE in module_wrap.cc
Browse files Browse the repository at this point in the history
PR-URL: #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>
  • Loading branch information
joyeecheung authored and jasnell committed Apr 19, 2018
1 parent 02db891 commit 7946910
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/module_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
1 change: 1 addition & 0 deletions src/node_errors.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 7946910

Please sign in to comment.