Fix type issue with exception

```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
```
This commit is contained in:
Dave Lucia 2024-09-19 10:56:30 -04:00 committed by Wout De Puysseleir
parent 8eda751c6e
commit 00f0ae4727

View file

@ -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")