Re: How to handle nested case
| Newsgroups | gmane.comp.lang.erlang.general |
|---|---|
| Message-ID | <[email protected]> |
Another option is to simply turn it into a sequential series of function calls.
This avoids the nesting though it's more verbose than the try or with variants.
get_nas_from_conf() ->
case get_radius_host() of
{ok, Server} -> step2(Server)
E -> E
end.
step2(Server) ->
case get_radius_port() of
{ok, Port} -> step3(Server, Port)
E -> E
end.
step3(Server, Port) ->
case get_radius_secret() of
{ok, Secret} -> {Server, Port, Secret};
E -> E
end.