Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bnoordhuis committed Nov 27, 2011
1 parent e85a95d commit 216019b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/node.cc
Expand Up @@ -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 */
}
Expand Down

1 comment on commit 216019b

@defunctzombie
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great happiness :)

Please sign in to comment.