Dialyzer errors out on cond statement that uses is_exception

Hello!

Does anybody know why dialyzer gives me this error:

lib/data_ingestion_web/live/preprocess_live.ex:137:pattern_match_cov
The pattern
:variable_

can never match, because previous clauses completely cover the type
NimbleCSV.ParseError.

when run on this code snippet:

 error_msg =
      cond do
        is_exception(reason, NimbleCSV.ParseError) -> # this is line 137
          "The file appears not to be a valid csv file"

        is_exception(reason) ->
          Exception.message(reason)

        true ->
          inspect(reason)
      end

Replacing NimbleCSV.ParseError with something more mundane (such as RuntimeError) leads to the same outcome

I don’t know how dialyzer works internally, but It seems to me that it doesn’t understand the semantics of is_exception/2

Btw: I’m aware that I can simply replace the condition with match?(^reason, %NimbleCSV.ParseError{}) -> "blah blah blah", but I’m still curious why the original version doesn’t work.