modules: fix error message for native add-ons without entry points
Trying to load an add-on without "init" or "modname_module" symbols would raise an "Out of memory" exception. Let's improve that error message.
This commit is contained in:
parent
e85a95dfa3
commit
216019b72d
11
src/node.cc
11
src/node.cc
@ -1594,9 +1594,14 @@ Handle<Value> DLOpen(const v8::Arguments& args) {
|
||||
err = uv_dlsym(lib, "init", reinterpret_cast<void**>(&mod->register_func));
|
||||
if (err.code != UV_OK) {
|
||||
uv_dlclose(lib);
|
||||
Local<Value> exception = Exception::Error(
|
||||
String::New("Out of memory."));
|
||||
return ThrowException(exception);
|
||||
|
||||
const char* message;
|
||||
if (err.code == UV_ENOENT)
|
||||
message = "Module entry point not found.";
|
||||
else
|
||||
message = "Out of memory.";
|
||||
|
||||
return ThrowException(Exception::Error(String::New(message)));
|
||||
}
|
||||
/* End Compatibility hack */
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user