From 216019b72d5085a0a12489dd15a1d4234f12e3b8 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sun, 27 Nov 2011 22:38:54 +0100 Subject: [PATCH] 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. --- src/node.cc | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/node.cc b/src/node.cc index d61fd82a955..d322590da0d 100644 --- a/src/node.cc +++ b/src/node.cc @@ -1594,9 +1594,14 @@ Handle DLOpen(const v8::Arguments& args) { err = uv_dlsym(lib, "init", reinterpret_cast(&mod->register_func)); if (err.code != UV_OK) { uv_dlclose(lib); - Local 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 */ }