Last active
March 11, 2017 16:45
-
-
Save falood/059ee5d7bff0fa812c557a2ce953c17c to your computer and use it in GitHub Desktop.
Revisions
-
falood revised this gist
Mar 11, 2017 . 1 changed file with 7 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,6 +4,10 @@ def func do raise "xxx" end rescue_from MatchError do IO.puts "error" end rescue_from Exception, as: e do IO.inspect e end @@ -16,7 +20,9 @@ def call do try do func() rescue [MatchError] -> IO.puts "error" e in [Exception] -> IO.inspect e end end -
falood created this gist
Mar 11, 2017 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ ```elixir def func do raise "xxx" end rescue_from Exception, as: e do IO.inspect e end ``` compile to ```elixir def call do try do func() rescue Exception as e -> IO.inspect e end end ```