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

Anatoly Kanivetsky commented on THRIFT-1151:
--------------------------------------------

Sorry, just uncomment this function in patch :)

Example of problem:

in some.thrift file:

struct StructA { 1: i16     x; }
struct StructB { 1: i32     x; }
struct StructC { 1: StructA x; }

in some.erl file, 

S1 = #structC{x=#structB{x=1}},
S2 = #structC{x=#structA{x=1}},

Sending S1 should fail with error, since it is not valid StructC.
Can be validated with service, or just by:

{ok, Transport} = thrift_memory_buffer:new(),
{ok, Protocol} = thrift_binary_protocol:new(Transport),
thrift_protocol:write(Protocol, {{struct, {'some_types', structC}}, S1})

> Produce more informative runtime error in case of schema and data mismatch 
> during serialization
> -----------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-1151
>                 URL: https://issues.apache.org/jira/browse/THRIFT-1151
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Erlang - Library
>            Reporter: Anatoly Kanivetsky
>         Attachments: diff.txt
>
>
> This patch adds generation of informative error during serialization of 
> struct, which is unmatched to it's struct_info.
> Instead of generating {error, enival} in gen_tcp during sending invalid 
> binary, it produces accurate error with some useful information.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to