Would that work? You said you were returning {ok, pid()}, not {reply, Whatever}.
How about just changing "ok when ReplyType == oneway_void" to "_ when ReplyType == oneway_void"? On 09/07/2010 03:12 AM, Roberto Aloi wrote: > Hi David, > > Nope, I'm using Thrift 0.4.0-dev, but now I think I know what's going on > behind the scenes. My Erlang code (the secret_function/2) was returning {ok, > pid()} rather than simply ok. > Even if this is conceptually wrong since I declared the function oneway_void, > it took me a while to identify the cause of the problem. > Maybe we could adjust the handle_succes function in Thrift so that it behaves > the same way the handle_function_catch already does. > This is how the handle_function_catch looks like at the moment: > > ... > case {ErrType, ErrData} of > _ when IsOneway -> > Stack = erlang:get_stacktrace(), > error_logger:warning_msg( > "oneway void ~p threw error which must be ignored: ~p", > [Function, {ErrType, ErrData, Stack}]), > {State, ok}; > ... > > Even if the function is declared as "oneway_void", when an exception is > raised, the problem is reported. A potential new handle_success function, > following the same reasoning, could then look like the following: > > handle_success(State = #thrift_processor{service = Service}, > Function, > Result) -> > ReplyType = Service:function_info(Function, reply_type), > StructName = atom_to_list(Function) ++ "_result", > > case Result of > {reply, ReplyData} when ReplyType =:= oneway_void -> > Stack = erlang:get_stacktrace(), > error_logger:warning_msg( > "oneway void ~p sent reply which must be ignored: ~p", > [Function, {ReplyData, Stack}]), > {State, ok}; > {reply, ReplyData} -> > Reply = {{struct, [{0, ReplyType}]}, {StructName, ReplyData}}, > send_reply(State, Function, ?tMessageType_REPLY, Reply); > > ok when ReplyType == {struct, []} -> > send_reply(State, Function, ?tMessageType_REPLY, {ReplyType, > {StructName}}); > > ok when ReplyType == oneway_void -> > %% no reply for oneway void > {State, ok} > end. > > Here I'm just checking if the function is defined as oneway_void and if this > is true and I still receive a return value different from the atom 'ok', I > report the accident, still ignoring the return value. > > What do you think? > > Regards, > > Roberto Aloi