Skip to content

Commit 89f7dbc

Browse files
author
José Valim
committed
Improve reading in error message
Signed-off-by: José Valim <jose.valim@plataformatec.com.br>
1 parent ec5afe2 commit 89f7dbc

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

lib/elixir/lib/exception.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ defmodule UndefinedFunctionError do
647647
def message(%{reason: :"function not exported", module: module, function: function, arity: arity, exports: exports}) do
648648
suffix =
649649
if macro_exported?(module, function, arity) do
650-
" but #{inspect(module)} defines a macro with the same name and arity." <>
650+
". However there is a macro with the same name and arity." <>
651651
" Be sure to require #{inspect(module)} if you intend to invoke this macro"
652652
else
653653
did_you_mean(module, function, arity, exports)

lib/elixir/test/elixir/exception_test.exs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,8 +386,9 @@ defmodule ExceptionTest do
386386
end
387387

388388
test "UndefinedFunctionError when the mfa is a macro but require wasn't called" do
389+
_ = Code.ensure_loaded(Integer)
389390
assert %UndefinedFunctionError{module: Integer, function: :is_odd, arity: 1} |> message ==
390-
"function Integer.is_odd/1 is undefined or private but Integer defines " <>
391+
"function Integer.is_odd/1 is undefined or private. However there is " <>
391392
"a macro with the same name and arity. Be sure to require Integer if " <>
392393
"you intend to invoke this macro"
393394
end

0 commit comments

Comments
 (0)