Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

sockets emit error event instead of calling error method

  • Loading branch information...
commit 94de7afb0cc75f57f9a629d0dcf6d12c950ba0f9 1 parent 7f23c0d
ethersheet-collective authored
Showing with 4 additions and 4 deletions.
  1. +3 −3 test/transactor.js
  2. +1 −1  transactor.js
View
6 test/transactor.js
@@ -66,11 +66,11 @@ describe('Transactor', function(){
});
it('invokes the error handler on the socket',function(done){
- socket.error = function(err,data){
+ socket.on('error',function(err,data){
assert.equal(err,test_error);
assert.equal(data,test_data);
done();
- }
+ });
socket.emit('data',test_data);
});
@@ -80,7 +80,7 @@ describe('Transactor', function(){
socket1.write = function(){
throw new Error('should not be called');
}
- socket.error = function(){};
+ socket.on('error',function(){});
socket.emit('data',test_data);
setTimeout(done,20);
});
View
2  transactor.js
@@ -23,7 +23,7 @@ Transactor.prototype.addSocket = function(channel,socket){
// add the supplied transaction handler to each channel on the socket
socket.on('data',function(data){
trans.transaction_handler(channel,data,function(err,data){
- if(err) return socket.error(err,data);
+ if(err) return socket.emit('error',err,data);
trans.broadcast(channel,data);
});
});
Please sign in to comment.
Something went wrong with that request. Please try again.