You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Andrew de Andrade (JIRA)" <ji...@apache.org> on 2015/02/11 03:51:11 UTC

[jira] [Created] (THRIFT-2997) nodejs: Convert Protocols into event-emitters

Andrew de Andrade created THRIFT-2997:
-----------------------------------------

             Summary: nodejs: Convert Protocols into event-emitters
                 Key: THRIFT-2997
                 URL: https://issues.apache.org/jira/browse/THRIFT-2997
             Project: Thrift
          Issue Type: Bug
          Components: Node.js - Compiler, Node.js - Library
            Reporter: Andrew de Andrade


Currently, methods like readMessageBegin() throw errors under certain conditions. In NodeJS, throwing should never be used for flow control.

TODO: convert TJSONProtocol, TBinaryProtocol and TCompactProtocol into event emitters that emit an 'error' event. Once converted, find all method calls that might trigger an error and make sure that a callback is bound to the transport error event, such as in the generated Processor code.

For example, the line {{var r = input.readMessageBegin();}} in Processor.process should return an error if it fails. r should be checked to see if it is an instanceof error. If it is, that error should be written to a new message on output and then the output should be flushed (just like what happens with TApplicationExceptionType.UNKNOWN_METHOD)




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)