From 00f0ae4727d665b5354d9f2dce991b3ff93e04cc Mon Sep 17 00:00:00 2001 From: Dave Lucia Date: Thu, 19 Sep 2024 10:56:30 -0400 Subject: [PATCH] Fix type issue with exception MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ```elixir Compiling 11 files (.ex) warning: unknown key .message in expression: err.message where "err" was given the type: # type: %{..., __exception__: true, __struct__: atom()} # from: lib/mix/tasks/configure_phoenix.ex:21 rescue err -> hint: when you rescue without specifying exception names, the variable is assigned a type of a struct but all of its fields are unknown. If you are trying to access an exception's :message key, either specify the exception names or use `Exception.message/1`. typing violation found at: │ 21 │ err -> log_error(err.message) │ ~~~~~~~ │ └─ lib/mix/tasks/configure_phoenix.ex:21:28: Mix.Tasks.LiveSvelte.ConfigurePhoenix.run/1 ``` --- lib/mix/tasks/configure_phoenix.ex | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/mix/tasks/configure_phoenix.ex b/lib/mix/tasks/configure_phoenix.ex index db215cb..edb1c6c 100644 --- a/lib/mix/tasks/configure_phoenix.ex +++ b/lib/mix/tasks/configure_phoenix.ex @@ -18,7 +18,10 @@ defmodule Mix.Tasks.LiveSvelte.ConfigurePhoenix do configure_application() configure_gitignore() rescue - err -> log_error(err.message) + err -> + err + |> Exception.message() + |> log_error() end Mix.Task.run("format")