Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-2997

nodejs: Convert Protocols into event-emitters

    XMLWordPrintableJSON

Details

    Description

      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)

      Attachments

        Activity

          People

            Unassigned Unassigned
            andrewdeandrade Andrew de Andrade
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: