-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Description
Elixir and Erlang/OTP versions
Erlang/OTP 25 [erts-13.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] [jit]
Elixir 1.15.7 (compiled with Erlang/OTP 25)
Operating system
macOS 12.4
Current behavior
Starting from Elixir 1.15, when setting up an error handler:
:error_logger.add_report_handler(ErrorHandler)
And running code that causes a process to crash (e.g. on IEx, via iex -S mix run
):
iex(1)> Task.async(fn -> raise "foo" end)
It does not call the handle_event
callback on ErrorHandler
.
I'm using the following error handler module:
defmodule ErrorHandler do
@behaviour :gen_event
def init([]), do: {:ok, []}
def handle_call(_, state), do: {:ok, state}
def handle_event(args, state) do
IO.inspect(args, label: "ERROR HANDLER CALLED")
{:ok, state}
end
end
With Elixir 1.15, ERROR HANDLER CALLED
never appears on the console. When testing the same code in Elixir 1.14 with the same OTP version, it does call the error handler and executes the IO.inspect
call.
In practice, we have noticed that the Bugsnag global error handler which still relies on error_logger
is not firing in Elixir 1.15.
I noticed looking at the error_logger docs that it is deprecated, but looks like it's still supported. Has its support been removed in Elixir 1.15?
Expected behavior
When calling :error_logger.add_report_handler(ErrorHandler)
and raising an error that crashes a process, the ErrorHandler
module should receive an event.
Example repo: https://github.com/guisehn/error_logger_issue