Exceptions and gen_server

Anton Krasovsky anton.krasovsky@REDACTED
Fri Nov 6 16:57:24 CET 2009


What would be the standard way of returning/throwing an exception in a
result to a gen_server:call?

Would something like that be reasonable:

a() ->
case gen_server:call(..., a) of
    {ok, Value} -> Value;
    {error, Error} -> throw({error, Error})
end

and

handle_call(a, ...) ->
case ... of
    {ok, Value} -> {reply, {ok, Value} , State};
    {error, Error} -> {reply, {error, Error} , State}
end

Regards,
Anton


More information about the erlang-questions mailing list