Initial Implementation

This commit is contained in:
Santiago Gimeno
2012-05-02 12:46:42 +02:00
parent 0484b764bf
commit b40f9a2f88
15 changed files with 1270 additions and 0 deletions

21
src/common.h Normal file
View File

@@ -0,0 +1,21 @@
#ifndef COMMON_H
#define COMMON_H
#include <node.h>
static void PerformCallback(v8::Handle<v8::Object> object,
v8::Persistent<v8::Function> &callback,
const unsigned argc, v8::Handle<v8::Value> *argv) {
// Wrap the callback function call in a TryCatch so that we can call
// node's FatalException afterwards. This makes it possible to catch
// the exception from JavaScript land using the
// process.on('uncaughtException') event.
v8::TryCatch try_catch;
callback->Call(object, argc, argv);
if (try_catch.HasCaught()) {
node::FatalException(try_catch);
}
}
#endif /* COMMON_H */