Skip to content

Commit

Permalink
Merge pull request #384 from jeremyjh/prevent-crash-format
Browse files Browse the repository at this point in the history
Fix exception when short format fails.
  • Loading branch information
asummers committed Mar 9, 2020
2 parents c4a6fd0 + a5bd2e2 commit 96cdaac
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions lib/dialyxir/formatter.ex
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,18 @@ defmodule Dialyxir.Formatter do
defp filter_warning(filterer, warning = {_, {file, line}, {warning_type, _}}, filter_map) do
if Map.has_key?(Dialyxir.Warnings.warnings(), warning_type) do
{skip?, matching_filters} =
filterer.filter_warning?(
{to_string(file), warning_type, line, format_warning(warning, :short)},
filter_map
)
try do
filterer.filter_warning?(
{to_string(file), warning_type, line, format_warning(warning, :short)},
filter_map
)
rescue
_ ->
{false, []}
catch
_ ->
{false, []}
end

filter_map =
Enum.reduce(matching_filters, filter_map, fn filter, filter_map ->
Expand Down

0 comments on commit 96cdaac

Please sign in to comment.