@@ -579,7 +579,7 @@ defmodule Exception do
579
579
#=> "#Function<...>/1"
580
580
581
581
"""
582
- def format_fa ( fun , arity ) do
582
+ def format_fa ( fun , arity ) when is_function ( fun ) do
583
583
"#{ inspect fun } #{ format_arity ( arity ) } "
584
584
end
585
585
@@ -603,7 +603,7 @@ defmodule Exception do
603
603
where func is the name of the enclosing function. Convert to
604
604
"anonymous fn in func/arity"
605
605
"""
606
- def format_mfa ( module , fun , arity ) when is_atom ( fun ) do
606
+ def format_mfa ( module , fun , arity ) when is_atom ( module ) and is_atom ( fun ) do
607
607
fun =
608
608
case inspect ( fun ) do
609
609
":" <> fun -> fun
@@ -623,7 +623,9 @@ defmodule Exception do
623
623
"(#{ Enum . join ( inspected , ", " ) } )"
624
624
end
625
625
626
- defp format_arity ( arity ) , do: "/#{ arity } "
626
+ defp format_arity ( arity ) when is_integer ( arity ) do
627
+ "/" <> integer_to_binary ( arity )
628
+ end
627
629
628
630
@ doc """
629
631
Formats the given file and line as shown in stacktraces.
@@ -657,7 +659,7 @@ defmodule Exception do
657
659
end
658
660
end
659
661
660
- defp format_location ( opts ) do
662
+ defp format_location ( opts ) when is_list ( opts ) do
661
663
format_file_line Keyword . get ( opts , :file ) , Keyword . get ( opts , :line ) , " "
662
664
end
663
665
0 commit comments