Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
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)