Skip to content

Commit 2cb0639

Browse files
author
José Valim
committed
Move from module_not_found to the more generic handler_not_found
1 parent 081e3b3 commit 2cb0639

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

lib/elixir/lib/gen_event.ex

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ defmodule GenEvent do
435435
436436
The return value `reply` is defined in the return value of `handle_call/2`.
437437
If the specified event handler is not installed, the function returns
438-
`{:error, :module_not_found}`.
438+
`{:error, :handler_not_found}`.
439439
"""
440440
@spec call(manager, handler, term, timeout) :: term | {:error, term}
441441
def call(manager, handler, request, timeout \\ 5000) do
@@ -454,7 +454,7 @@ defmodule GenEvent do
454454
455455
The event manager will call `terminate/2` to terminate the event handler
456456
and return the callback value. If the specified event handler is not
457-
installed, the function returns `{:error, :module_not_found}`.
457+
installed, the function returns `{:error, :handler_not_found}`.
458458
"""
459459
@spec remove_handler(manager, handler, term) :: term | {:error, term}
460460
def remove_handler(manager, handler, args) do
@@ -874,7 +874,7 @@ defmodule GenEvent do
874874
defp server_call(module, query, handlers, name) do
875875
case :lists.keyfind(module, handler(:id) + 1, handlers) do
876876
false ->
877-
{false, {:error, :module_not_found}, handlers}
877+
{false, {:error, :handler_not_found}, handlers}
878878
handler ->
879879
case server_call_update(handler, query, name, handlers) do
880880
{{hib, handler}, reply} ->
@@ -996,7 +996,7 @@ defmodule GenEvent do
996996
{:value, handler, handlers} ->
997997
{do_terminate(handler, args, last_in, name, reason), handlers}
998998
false ->
999-
{{:error, :module_not_found}, handlers}
999+
{{:error, :handler_not_found}, handlers}
10001000
end
10011001
end
10021002

lib/elixir/test/elixir/gen_event_test.exs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ defmodule GenEventTest do
1818
raise "oops"
1919
end
2020

21-
def init({:swap, {:error, :module_not_found}}) do
22-
{:error, :module_not_found_on_swap}
21+
def init({:swap, {:error, :handler_not_found}}) do
22+
{:error, :handler_not_found_on_swap}
2323
end
2424

2525
def init({:swap, parent}) when is_pid(parent) do
@@ -291,15 +291,15 @@ defmodule GenEventTest do
291291
GenEvent.add_handler(pid, ReplyHandler, {self(), false}, monitor: true)
292292

293293
assert GenEvent.remove_handler(pid, {ReplyHandler, self()}, :ok) ==
294-
{:error, :module_not_found}
294+
{:error, :handler_not_found}
295295
assert GenEvent.remove_handler(pid, ReplyHandler, :ok) ==
296296
{:terminate, :ok}
297297
assert_receive {:terminate, :ok}
298298

299299
GenEvent.add_handler(pid, {ReplyHandler, self()}, {self(), false}, monitor: true)
300300

301301
assert GenEvent.remove_handler(pid, ReplyHandler, :ok) ==
302-
{:error, :module_not_found}
302+
{:error, :handler_not_found}
303303
assert {:error, {%RuntimeError{}, _}} =
304304
GenEvent.remove_handler(pid, {ReplyHandler, self()}, :raise)
305305

@@ -326,7 +326,7 @@ defmodule GenEventTest do
326326
# The handler is initialized even when the module does not exist
327327
# on swap. However, in this case, we are returning an error on init.
328328
assert GenEvent.swap_handler(pid, ReplyHandler, :swapped, ReplyHandler, :swap) ==
329-
{:error, :module_not_found_on_swap}
329+
{:error, :handler_not_found_on_swap}
330330
end
331331

332332
test "notify/2" do
@@ -475,7 +475,7 @@ defmodule GenEventTest do
475475

476476
assert GenEvent.add_handler(pid, DefaultHandler, []) == :ok
477477
assert GenEvent.call(pid, UnknownHandler, :messages) ==
478-
{:error, :module_not_found}
478+
{:error, :handler_not_found}
479479
assert GenEvent.call(pid, DefaultHandler, :whatever) ==
480480
{:error, {:bad_call, :whatever}}
481481
assert GenEvent.which_handlers(pid) == []

lib/logger/test/logger_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ defmodule LoggerTest do
3434
assert :ok = Logger.remove_backend(:console)
3535
assert Application.get_env(:logger, :backends) == []
3636
assert Logger.remove_backend(:console) ==
37-
{:error, :module_not_found}
37+
{:error, :handler_not_found}
3838

3939
assert capture_log(fn ->
4040
assert Logger.debug("hello", []) == :ok

0 commit comments

Comments
 (0)