Browse Source

Throw Error exceptions from node.dlopen()

v0.7.4-release
Ryan 16 years ago
parent
commit
3862fdade4
  1. 8
      src/node.cc

8
src/node.cc

@ -126,13 +126,15 @@ node_dlopen (const v8::Arguments& args)
void *handle = dlopen(*filename, RTLD_LAZY); void *handle = dlopen(*filename, RTLD_LAZY);
if (handle == NULL) { if (handle == NULL) {
return ThrowException(String::New("dlopen() failed.")); Local<Value> exception = Exception::Error(String::New(dlerror()));
return ThrowException(exception);
} }
void *init_handle = dlsym(handle, "init"); void *init_handle = dlsym(handle, "init");
if (init_handle == NULL) { if (init_handle == NULL) {
ThrowException(String::New("No 'init' symbol found in module.")); Local<Value> exception =
return Undefined(); Exception::Error(String::New("No 'init' symbol found in module."));
return ThrowException(exception);
} }
extInit init = reinterpret_cast<extInit>(init_handle); extInit init = reinterpret_cast<extInit>(init_handle);

Loading…
Cancel
Save