return NULL;
}
+ TryCatch try_catch;
+
Local<Object> connection_handle =
HTTPConnection::server_constructor_template->GetFunction()->NewInstance(0, NULL);
+ if (connection_handle.IsEmpty()) {
+ fatal_exception(try_catch);
+ return NULL;
+ }
+
HTTPConnection *connection = NODE_UNWRAP(HTTPConnection, connection_handle);
if (!connection) return NULL;
this.onBodyComplete = function () { return true; }
}
- this.onMessage = function ( ) {
+ connection.onMessage = function ( ) {
+ puts("got onMessage");
var msg = new Message();
msg.path = "";
return NULL;
}
+ TryCatch try_catch;
+
Local<Object> connection_handle =
Connection::constructor_template->GetFunction()->NewInstance(0, NULL);
+
+ if (connection_handle.IsEmpty()) {
+ fatal_exception(try_catch);
+ return NULL;
+ }
Connection *connection = NODE_UNWRAP(Connection, connection_handle);
if (!connection) return NULL;
Handle<Value> argv[1] = { connection_handle };
- TryCatch try_catch;
Local<Value> ret = connection_handler->Call(handle_, 1, argv);
if (ret.IsEmpty())
ObjectWrap::Unwrap (Handle<Object> handle)
{
HandleScope scope;
- if(handle.IsEmpty() || handle->InternalFieldCount() == 0) {
- ThrowException(String::New("Tried to unwrap object without internal field."));
+ if (handle.IsEmpty()) {
+ fprintf(stderr, "Node: Tried to unwrap empty object.\n");
+ return NULL;
+ }
+ if ( handle->InternalFieldCount() == 0) {
+ fprintf(stderr, "Node: Tried to unwrap object without internal fields.\n");
return NULL;
}
Local<Value> value = handle->GetInternalField(0);
if (value.IsEmpty()) {
- ThrowException(String::New("Tried to unwrap object with empty internal field."));
+ fprintf(stderr, "Tried to unwrap object with empty internal field.\n");
return NULL;
}
Handle<External> field = Handle<External>::Cast(value);