thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ro...@bufferoverflow.ch
Subject Re: JSONProtocol: wrong MessageType on Exceptions?
Date Fri, 18 Jun 2010 14:22:07 GMT
Thanks David!

I figured out, that the exception couldn't be thrown because  
initialization of numeric base types within JavsScript Generator was  
done with 0 instead of null and the checks do compare against null.
This was not visible with the Tests provided with the JavaScript  
bindings, because the ThriftTest.thrift definition does not have a  
combination of a base type return value and an exception.

The Patch is here available: https://issues.apache.org/jira/browse/THRIFT-550

Regards

Roger



Quoting David Reiss <dreiss@facebook.com>:

> T_EXCEPTION is only used when the server sends a TApplicationException,
> which happens when it cannot understand the request or has an unexpected
> problem processing it.  For normal user-defined exceptions, the T_REPLY
> value is used and the response indicates what the result was.
>
> --David
>
> Roger Meier wrote:
>> Hi all
>>
>> I did some tests with THttpServer.cpp, JavaScript langiage binding and
>> Tutorial-CppServer using the JSON protocol. I have a strange behavior,
>> that I do not understand.
>>
>> Inside the JSON protocol, the MessageType for exceptions seems to be 2
>> instead of 3, see below.
>>
>> What do I not understand here?
>>
>> Regards
>>
>> Roger
>>
>>
>> -----------------------------
>>
>> Request:
>> [1,"calculate",1,0,{"1":{"i32":1},"2":{"rec":{"1":{"i32":1},"2":{"i32":0},"3":{"i32":4}}}}]
>>
>> Response:
>> [1,"calculate",2,0,{"1":{"rec":{"1":{"i32":4},"2":{"str":"Cannot divide
>> by 0"}}}}]
>>
>>
>> enum TMessageType {
>>    T_CALL       = 1,
>>    T_REPLY      = 2,
>>    T_EXCEPTION  = 3,
>>    T_ONEWAY     = 4
>> };
>>
>
>
>





Mime
View raw message