Skip to content

Commit 26bc9d9

Browse files
author
Ricardo de Cillo
committed
Make sure the given module is loaded before trying reload it.
1 parent ddd4afb commit 26bc9d9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/iex/lib/iex/helpers.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,8 +308,8 @@ defmodule IEx.Helpers do
308308
end
309309

310310
defp do_r(module) do
311-
unless :code.is_loaded(module) do
312-
raise ArgumentError, message: "Unloaded module #{module}. Try loading the module's beam file with `IEx.Helpers.l\\1`"
311+
unless Code.ensure_loaded?(module) do
312+
raise ArgumentError, message: "The module is not loaded and it could not be found"
313313
end
314314

315315
source = source(module)

lib/iex/test/iex/helpers_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ defmodule IEx.HelpersTest do
305305
end
306306

307307
test "r helper unavailable" do
308-
assert_raise ArgumentError, "Unloaded module non_existent_module. Try loading the module's beam file with `IEx.Helpers.l\\1`", fn ->
308+
assert_raise ArgumentError, "The module is not loaded and it could not be found", fn ->
309309
r :non_existent_module
310310
end
311311
end

0 commit comments

Comments
 (0)