thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roberto Aloi <roberto.a...@erlang-solutions.com>
Subject Function clause on "oneway_void" [Thrift-Erlang]
Date Thu, 02 Sep 2010 17:41:25 GMT
Hi all,

I'm using a "oneway" modifier in one my Thrift function definitions:

...
oneway void secret_function(1: string x, 2: string y),
...

When generating the respective Erlang code via Thrift, this is translated into:

...
function_info('secret_function', reply_type) ->
  oneway_void;
function_info('secret_function', exceptions) ->
  {struct, []};
...

Please note the "oneway_void" atom there.

When the "secret_function" function is executed, I get the following error:

=ERROR REPORT==== 2-Sep-2010::18:17:08 ===
oneway void secret_function threw error which must be ignored: {error,
                                                                  function_clause,
                                                                  [{thrift_protocol,
                                                                    term_to_typeid,
                                                                    [oneway_void]}, ...

Independently from the possible bugs contained in the user code, here the thrift_protocol:term_to_typeid/1
function is being called with the oneway_void atom as an argument, which causes a function
clause. In fact, reading from the code (thrift_protocol.erl):

...
term_to_typeid(void) -> ?tType_VOID;
term_to_typeid(bool) -> ?tType_BOOL;
term_to_typeid(byte) -> ?tType_BYTE;
term_to_typeid(double) -> ?tType_DOUBLE;
term_to_typeid(i16) -> ?tType_I16;
term_to_typeid(i32) -> ?tType_I32;
term_to_typeid(i64) -> ?tType_I64;
term_to_typeid(string) -> ?tType_STRING;
term_to_typeid({struct, _}) -> ?tType_STRUCT;
term_to_typeid({map, _, _}) -> ?tType_MAP;
term_to_typeid({set, _}) -> ?tType_SET;
term_to_typeid({list, _}) -> ?tType_LIST.
...

A bug? Any other explanation? Why is "oneway_void" being passed to that function?

Regards,

Roberto Aloi
-- 
University of Kent - Erlang Solutions Ltd.
Blog: http://aloiroberto.wordpress.com
Twitter: @prof3ta


Mime
View raw message