Skip to content

Commit ad62bb9

Browse files
ggpasqualinoJosé Valim
authored andcommitted
Fix example of "Catching values of any kind" (#7241)
The code snippet in the session "Catching values of any kind" of the documentation of `try` had wrong indentation, because of that the snippet was wrongly formatted.
1 parent 18eef65 commit ad62bb9

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

lib/elixir/lib/kernel/special_forms.ex

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,19 +1776,19 @@ defmodule Kernel.SpecialForms do
17761776
allows matching on both the *kind* of the caught value as well as the value
17771777
itself:
17781778
1779-
try do
1780-
exit(:shutdown)
1781-
catch
1782-
:exit, value
1783-
IO.puts "Exited with value #{inspect(value)}"
1784-
end
1779+
try do
1780+
exit(:shutdown)
1781+
catch
1782+
:exit, value
1783+
IO.puts "Exited with value #{inspect(value)}"
1784+
end
17851785
1786-
try do
1787-
exit(:shutdown)
1788-
catch
1789-
kind, value when kind in [:exit, :throw] ->
1790-
IO.puts "Caught exit or throw with value #{inspect(value)}"
1791-
end
1786+
try do
1787+
exit(:shutdown)
1788+
catch
1789+
kind, value when kind in [:exit, :throw] ->
1790+
IO.puts "Caught exit or throw with value #{inspect(value)}"
1791+
end
17921792
17931793
The `catch` clause also supports `:error` alongside `:exit` and `:throw` as
17941794
in Erlang, although this is commonly avoided in favor of `raise`/`rescue` control

0 commit comments

Comments
 (0)