Permalink
Browse files

[lib] temp fix for gh-6

  • Loading branch information...
Paolo Fragomeni
Paolo Fragomeni committed Feb 10, 2012
1 parent 551d453 commit 78ee4c1c3a096d895945a5e66e2963c09e3a9243
Showing with 13 additions and 0 deletions.
  1. +13 −0 lib/nssocket.js
View
@@ -283,6 +283,19 @@ NsSocket.prototype.connect = function connect(/*port, host, callback*/) {
return this.emit('error', new Error('Unknown Socket Type'));
}
+ //
+ // TODO: should transfer all the events? not sure exactly how
+ // i should handle this yet.
+ //
+ var errHandlers = self.listeners('error');
+
+ if (errHandlers.length > 0) {
+ //
+ // copy the last error from nssocker onto the error event.
+ //
+ self.socket._events.error = errHandlers[errHandlers.length-1];
+ }
+
this.connected = true;
this.socket.connect.apply(this.socket, args);
};

0 comments on commit 78ee4c1

Please sign in to comment.