THRIFT-3927: Emit an error instead of throw an error in the async callback

Client: node
Patch: lifei

Because the data event of a connection is async handled, throw an exception can not tell the code the error. emit the error should be the correct way to handle the errors.

Closes #1087
This commit is contained in:
jfarrell 2016-09-15 23:37:43 -04:00
parent ddc53c3248
commit 205dc19556
2 changed files with 2 additions and 2 deletions

View File

@ -150,7 +150,7 @@ var Connection = exports.Connection = function(stream, options) {
transport_with_data.rollbackPosition();
}
else {
throw e;
self.emit('error', e);
}
}
}));

View File

@ -157,7 +157,7 @@ var HttpConnection = exports.HttpConnection = function(host, port, options) {
if (e instanceof InputBufferUnderrunError) {
transport_with_data.rollbackPosition();
} else {
throw e;
self.emit('error', e);
}
}
}