@@ -579,7 +579,7 @@ defmodule Exception do
579579 #=> "#Function<...>/1"
580580
581581 """
582- def format_fa ( fun , arity ) do
582+ def format_fa ( fun , arity ) when is_function ( fun ) do
583583 "#{ inspect fun } #{ format_arity ( arity ) } "
584584 end
585585
@@ -603,7 +603,7 @@ defmodule Exception do
603603 where func is the name of the enclosing function. Convert to
604604 "anonymous fn in func/arity"
605605 """
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
607607 fun =
608608 case inspect ( fun ) do
609609 ":" <> fun -> fun
@@ -623,7 +623,9 @@ defmodule Exception do
623623 "(#{ Enum . join ( inspected , ", " ) } )"
624624 end
625625
626- defp format_arity ( arity ) , do: "/#{ arity } "
626+ defp format_arity ( arity ) when is_integer ( arity ) do
627+ "/" <> integer_to_binary ( arity )
628+ end
627629
628630 @ doc """
629631 Formats the given file and line as shown in stacktraces.
@@ -657,7 +659,7 @@ defmodule Exception do
657659 end
658660 end
659661
660- defp format_location ( opts ) do
662+ defp format_location ( opts ) when is_list ( opts ) do
661663 format_file_line Keyword . get ( opts , :file ) , Keyword . get ( opts , :line ) , " "
662664 end
663665
0 commit comments