mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 02:45:22 +00:00
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:
parent
ddc53c3248
commit
205dc19556
@ -150,7 +150,7 @@ var Connection = exports.Connection = function(stream, options) {
|
||||
transport_with_data.rollbackPosition();
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
self.emit('error', e);
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user