I have a stringified value that may be an integer or boolean ("20", "true"). I would like to cast the value to it's type, however, when I do a conversion on the wrong type, I get a runtime error:
iex> String.to_existing_atom("20")
** (ArgumentError) argument error
:erlang.binary_to_existing_atom("20", :utf8)
iex> String.to_integer("true")
** (ArgumentError) argument error
:erlang.binary_to_integer("true")