ArgumentError exception (Elixir v1.19.0-dev)
View SourceAn exception raised when an argument to a function is invalid.
You can raise this exception when you want to signal that an argument to
a function is invalid. For example, this exception is raised when calling
Integer.to_string/1
with an invalid argument:
iex> Integer.to_string(1.0)
** (ArgumentError) errors were found at the given arguments:
* 1st argument: not an integer
:erlang.integer_to_binary(1.0)
ArgumentError
exceptions have a single field, :message
(a String.t/0
),
which is public and can be accessed freely when reading or creating ArgumentError
exceptions.