diff --git a/lib/mix/lib/mix/tasks/compile.erlang.ex b/lib/mix/lib/mix/tasks/compile.erlang.ex index 16b43f9af5f..12262fe926f 100644 --- a/lib/mix/lib/mix/tasks/compile.erlang.ex +++ b/lib/mix/lib/mix/tasks/compile.erlang.ex @@ -100,9 +100,10 @@ defmodule Mix.Tasks.Compile.Erlang do file = Erlang.to_erl_file(Path.rootname(input, ".erl")) case :compile.file(file, erlc_options) do - {:error, :badarg} -> + # TODO: Don't handle {:error, :badarg} when we require OTP 24 + error when error == :error or error == {:error, :badarg} -> message = - "Compiling Erlang #{inspect(file)} failed with ArgumentError, probably because of invalid :erlc_options" + "Compiling Erlang file #{inspect(file)} failed, probably because of invalid :erlc_options" Mix.raise(message) diff --git a/lib/mix/test/mix/tasks/compile.erlang_test.exs b/lib/mix/test/mix/tasks/compile.erlang_test.exs index 414642ebada..316636c02b7 100644 --- a/lib/mix/test/mix/tasks/compile.erlang_test.exs +++ b/lib/mix/test/mix/tasks/compile.erlang_test.exs @@ -14,7 +14,7 @@ defmodule Mix.Tasks.Compile.ErlangTest do @tag erlc_options: [{:d, 'foo', 'bar'}] test "raises on invalid erlc_options" do in_fixture("compile_erlang", fn -> - assert_raise Mix.Error, ~r"failed with ArgumentError", fn -> + assert_raise Mix.Error, ~r"Compiling Erlang file '.*' failed", fn -> capture_io(fn -> Mix.Tasks.Compile.Erlang.run([]) end)