From a5bd2e2442eb59def58f68a9df566a4229631030 Mon Sep 17 00:00:00 2001 From: Andrew Summers Date: Sat, 7 Mar 2020 10:15:18 -0600 Subject: [PATCH] Fix exception when short format fails. --- lib/dialyxir/formatter.ex | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/dialyxir/formatter.ex b/lib/dialyxir/formatter.ex index 68c70905..3bdc2edb 100644 --- a/lib/dialyxir/formatter.ex +++ b/lib/dialyxir/formatter.ex @@ -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 ->