Skip to content

Commit 8a1c5c3

Browse files
voltoneJosé Valim
authored andcommitted
Fix DynamicSupervisor error report
1 parent 00deab9 commit 8a1c5c3

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/elixir/lib/dynamic_supervisor.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -932,7 +932,7 @@ defmodule DynamicSupervisor do
932932

933933
defp report_error(error, reason, pid, child, %{name: name}) do
934934
:error_logger.error_report(
935-
:supervision_report,
935+
:supervisor_report,
936936
supervisor: name,
937937
errorContext: error,
938938
reason: reason,

lib/logger/test/logger/translator_test.exs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,23 @@ defmodule Logger.TranslatorTest do
694694
"""
695695
end
696696

697+
test "translates DynamicSupervisor reports abnormal shutdown" do
698+
assert capture_log(:info, fn ->
699+
trap = Process.flag(:trap_exit, true)
700+
child = %{id: __MODULE__, start: {__MODULE__, :abnormal, []}}
701+
{:ok, pid} = DynamicSupervisor.start_link(strategy: :one_for_one)
702+
{:ok, _pid2} = DynamicSupervisor.start_child(pid, child)
703+
Process.exit(pid, :normal)
704+
receive do: ({:EXIT, ^pid, _} -> :ok)
705+
Process.flag(:trap_exit, trap)
706+
end) =~ ~r"""
707+
\[error\] Child :undefined of Supervisor #PID<\d+\.\d+\.\d+> \(Supervisor\.Default\) shutdown abnormally
708+
\*\* \(exit\) :stop
709+
Pid: #PID<\d+\.\d+\.\d+>
710+
Start Call: Logger.TranslatorTest.abnormal\(\)
711+
"""
712+
end
713+
697714
test "translates :supervisor_bridge progress" do
698715
assert capture_log(:info, fn ->
699716
trap = Process.flag(:trap_exit, true)

0 commit comments

Comments
 (0)