IO.warn
You're seeing just the function
warn
, go back to IO module for more information.
Specs
warn(chardata() | String.Chars.t()) :: :ok
Writes a message
to stderr, along with the current stacktrace.
It returns :ok
if it succeeds.
Do not call this function at the tail of another function. Due to tail
call optimization, a stacktrace entry would not be added and the
stacktrace would be incorrectly trimmed. Therefore make sure at least
one expression (or an atom such as :ok
) follows the IO.warn/1
call.
Examples
IO.warn("variable bar is unused")
#=> warning: variable bar is unused
#=> (iex) evaluator.ex:108: IEx.Evaluator.eval/4
Specs
warn(chardata() | String.Chars.t(), Exception.stacktrace()) :: :ok
Writes a message
to stderr, along with the given stacktrace
.
This function also notifies the compiler a warning was printed
(in case --warnings-as-errors was enabled). It returns :ok
if it succeeds.
An empty list can be passed to avoid stacktrace printing.
Examples
stacktrace = [{MyApp, :main, 1, [file: 'my_app.ex', line: 4]}]
IO.warn("variable bar is unused", stacktrace)
#=> warning: variable bar is unused
#=> my_app.ex:4: MyApp.main/1