You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by jf...@apache.org on 2016/09/16 03:39:34 UTC

thrift git commit: THRIFT-3927: Emit an error instead of throw an error in the async callback Client: node Patch: lifei

Repository: thrift
Updated Branches:
  refs/heads/master ddc53c324 -> 205dc1955


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


Project: http://git-wip-us.apache.org/repos/asf/thrift/repo
Commit: http://git-wip-us.apache.org/repos/asf/thrift/commit/205dc195
Tree: http://git-wip-us.apache.org/repos/asf/thrift/tree/205dc195
Diff: http://git-wip-us.apache.org/repos/asf/thrift/diff/205dc195

Branch: refs/heads/master
Commit: 205dc19556eac3c0ab2d1965c4636b78f8922fae
Parents: ddc53c3
Author: jfarrell <jf...@apache.org>
Authored: Thu Sep 15 23:37:43 2016 -0400
Committer: jfarrell <jf...@apache.org>
Committed: Thu Sep 15 23:38:58 2016 -0400

----------------------------------------------------------------------
 lib/nodejs/lib/thrift/connection.js      | 2 +-
 lib/nodejs/lib/thrift/http_connection.js | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/thrift/blob/205dc195/lib/nodejs/lib/thrift/connection.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/lib/thrift/connection.js b/lib/nodejs/lib/thrift/connection.js
index 23cb01c..575d516 100644
--- a/lib/nodejs/lib/thrift/connection.js
+++ b/lib/nodejs/lib/thrift/connection.js
@@ -150,7 +150,7 @@ var Connection = exports.Connection = function(stream, options) {
         transport_with_data.rollbackPosition();
       }
       else {
-        throw e;
+        self.emit('error', e);
       }
     }
   }));

http://git-wip-us.apache.org/repos/asf/thrift/blob/205dc195/lib/nodejs/lib/thrift/http_connection.js
----------------------------------------------------------------------
diff --git a/lib/nodejs/lib/thrift/http_connection.js b/lib/nodejs/lib/thrift/http_connection.js
index f3fcd74..18bfadb 100644
--- a/lib/nodejs/lib/thrift/http_connection.js
+++ b/lib/nodejs/lib/thrift/http_connection.js
@@ -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);
       }
     }
   }