RosettaCodeData/Task/Stack-traces/Elixir/stack-traces.elixir

26 lines
327 B
Text
Raw Permalink Normal View History

2016-12-05 22:15:40 +01:00
defmodule Stack_traces do
def main do
{:ok, a} = outer
IO.inspect a
end
defp outer do
{:ok, a} = middle
{:ok, a}
end
defp middle do
{:ok, a} = inner
{:ok, a}
end
defp inner do
try do
throw(42)
catch 42 -> {:ok, :erlang.get_stacktrace}
end
end
end
Stack_traces.main