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

Commit

Permalink
Throw Error exceptions from node.dlopen()
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Aug 31, 2009
1 parent afd9e71 commit 3862fda
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/node.cc
Expand Up @@ -126,13 +126,15 @@ node_dlopen (const v8::Arguments& args)

void *handle = dlopen(*filename, RTLD_LAZY);
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");
if (init_handle == NULL) {
ThrowException(String::New("No 'init' symbol found in module."));
return Undefined();
Local<Value> exception =
Exception::Error(String::New("No 'init' symbol found in module."));
return ThrowException(exception);
}
extInit init = reinterpret_cast<extInit>(init_handle);

Expand Down

0 comments on commit 3862fda

Please sign in to comment.