[erlang-questions] catch

Wes James comptekki@REDACTED
Tue Mar 1 19:24:46 CET 2011


On Tue, Mar 1, 2011 at 11:01 AM, Lukas Larsson
<lukas.larsson@REDACTED> wrote:
> You can match it out in the case, or maybe have a look at try ... catch ... end in the documentation.
>
> case catch(list_to_integer(String)) of
>   {'EXIT', {badarg,_}} ->
>        io:format("~n~p~n~n",["Arg not Int"]);
>    I ->
>        do_stuff(I)
> end
>
> Lukas


thx, Lukas - that is similar to Fernando's answer and is just what I needed.

-wes


More information about the erlang-questions mailing list