Skip to content

Commit ee561bd

Browse files
committed
Fix raising Code.LoadError
1 parent 6696133 commit ee561bd

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

lib/elixir/lib/code.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ defmodule Code do
463463
if File.regular?(file) do
464464
file
465465
else
466-
raise LoadError, file: file
466+
raise Code.LoadError, file: file
467467
end
468468
end
469469
end

lib/elixir/test/elixir/code_test.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ defmodule CodeTest do
7070

7171
test :eval_file do
7272
assert Code.eval_file(fixture_path("code_sample.exs")) == {3, [var: 3]}
73+
74+
assert_raise Code.LoadError, fn ->
75+
Code.eval_file("non_existent.exs")
76+
end
7377
end
7478

7579
test :require do

0 commit comments

Comments
 (0)