diff --git a/apps/elixir_ls_debugger/lib/debugger/server.ex b/apps/elixir_ls_debugger/lib/debugger/server.ex index 23659fb80..92199f2fa 100644 --- a/apps/elixir_ls_debugger/lib/debugger/server.ex +++ b/apps/elixir_ls_debugger/lib/debugger/server.ex @@ -665,16 +665,19 @@ defmodule ElixirLS.Debugger.Server do {:DOWN, ^ref, :process, _pid, reason} -> if reason != :normal do - Output.debugger_important("Launch request failed") + message = "Launch request failed with reason\n" <> Exception.format_exit(reason) - Output.debugger_console( - "Launch request failed with reason\n" <> Exception.format_exit(reason) - ) + Output.debugger_console(message) exit_code = 1 Output.send_event("exited", %{"exitCode" => exit_code}) Output.send_event("terminated", %{"restart" => false}) - config + + raise ServerError, + message: "launchError", + format: message, + variables: %{}, + show_user: true else raise "exit reason #{inspect(reason)} was not expected" end diff --git a/apps/elixir_ls_debugger/test/debugger_test.exs b/apps/elixir_ls_debugger/test/debugger_test.exs index ecd966dc4..dcfa089b0 100644 --- a/apps/elixir_ls_debugger/test/debugger_test.exs +++ b/apps/elixir_ls_debugger/test/debugger_test.exs @@ -450,7 +450,7 @@ defmodule ElixirLS.Debugger.ServerTest do end @tag :fixture - test "launch mix task that fails to initialze", %{server: server} do + test "launch mix task that fails to initialize", %{server: server} do in_fixture(__DIR__, "mix_project", fn -> Server.receive_packet( server, @@ -474,7 +474,20 @@ defmodule ElixirLS.Debugger.ServerTest do }) ) - assert_receive(response(_, 2, "launch", %{}), 5000) + assert_receive( + error_response( + _, + 2, + "launch", + "launchError", + "Launch request failed with reason" <> _, + %{}, + _, + _ + ), + 5000 + ) + refute_receive(event(_, "initialized", %{})) assert_receive event(_, "output", %{