How to handle nested case
hokan.stenholm@REDACTED
hokan.stenholm@REDACTED
Sun Sep 19 20:36:03 CEST 2021
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20210919/0ce315c0/attachment.htm>
More information about the erlang-questions
mailing list