[ 
https://issues.apache.org/jira/browse/THRIFT-1267?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13183175#comment-13183175
 ] 

Henrique Mendonca edited comment on THRIFT-1267 at 1/11/12 9:11 AM:
--------------------------------------------------------------------

I was trying to extend Roger's new test.sh to use a nodejs server but I noticed 
that the compiler wasn't working any more... no exceptions, namespaces, etc. 
I've also create a first draft of a test server (see attached 
*test/nodejs/server.js*)
under thrift/test run:
{code}
../compiler/cpp/thrift --gen js:node -o ./nodejs ThriftTest.thrift
export NODE_PATH=../lib/nodejs/lib/thrift/
node nodejs/server.js
{code}

I had to re-base this old patch 'thrift-1267-callback-ns-fix.patch' and make 
some other small changes. Please someone have a look/test and commit this. 
Otherwise we won't be able to use nodejs.

That's what I was trying to archive, if anyone wants to have a look, I think 
there is still something missing since it doesn't seem to close the stream 
properly... (I only see the first test)
*test/test.sh:*
{code}
do_test "cpp-nodejs" "binary" "buffered-ip" \
        "cpp/TestClient" \
        "node nodejs/server.js" \
        "1"
{code}

Thanks
                
      was (Author: henrique):
    I was trying to extend Roger's new test.sh to use a nodejs server but I 
notice that the compiler wasn't working any more... I've also create a first 
draft of a test server (see attached *test/nodejs/server.js*)
under thrift/test run:
{code}
../compiler/cpp/thrift --gen js:node -o ./nodejs ThriftTest.thrift
node nodejs/server.js 
{code}

I had to re-base this old patch 'thrift-1267-callback-ns-fix.patch' and make 
some other small changes. Please someone have a look/test and commit this. 
Otherwise we won't be able to use nodejs.

That's what I was trying to archive, if anyone wants to have a look, I think 
there is still something missing since it doesn't seem to close the stream 
properly... (I only see the first test)
*test/test.sh:*
{code}
do_test "cpp-nodejs" "binary" "buffered-ip" \
        "cpp/TestClient" \
        "node nodejs/server.js" \
        "1"
{code}

Thanks
                  
> Node.js can't throw exceptions. 
> --------------------------------
>
>                 Key: THRIFT-1267
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1267
>             Project: Thrift
>          Issue Type: Improvement
>          Components: JavaScript - Compiler, Node.js - Compiler
>    Affects Versions: 0.7
>            Reporter: Hans Duedal
>              Labels: compiler, javascript, node, nodejs
>             Fix For: 0.9
>
>         Attachments: THRIFT-1267-ns-fixes.patch, nodejs-exception.patch, 
> server.js, thrift-1267-callback-ns-fix.patch, thrift-1267-callback.patch
>
>
> There is no way as far as I can tell for node.js servers to throw thrift 
> exceptions.
> I have made a patch to allow it to throw exceptions. It lets the node.js 
> server implementation give params directly to the result object, thereby 
> being able to specify the exception. It doesn't affect normal (non exception) 
> return data.
> Test case: https://gist.github.com/1151782
> Install thrift module "npm install thrift", generate thrift "thrift --gen 
> js:node test.thrift" and run server then client.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to