From 6fff160604ccf60fa8682387d66f3d631c6e9030 Mon Sep 17 00:00:00 2001 From: bell Date: Sun, 22 Dec 2013 03:18:08 +0400 Subject: Suppress error report when child was terminated normally Description: Let's assume we have a supervisor_bridge as a non-permanent child of a supervisor. When the bridge terminates normally it reports by error_logger:error_report, but the supervisor does nothing. So we have tons (especially, when it's simple_one_for_one) of error messages while everything is completely ok. Let's assume we have a supervisor_bridge as a permanent child of a supervisor. When the bridge terminates, it invokes error_logger, but what for? The supervisor will invoke error_logger about this error right after that. So what is the reason for the error_logger to log for normally terminating children in this case? --- lib/stdlib/src/supervisor_bridge.erl | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/stdlib/src/supervisor_bridge.erl b/lib/stdlib/src/supervisor_bridge.erl index e8405ab9a4..ff4502f0b9 100644 --- a/lib/stdlib/src/supervisor_bridge.erl +++ b/lib/stdlib/src/supervisor_bridge.erl @@ -101,7 +101,16 @@ handle_cast(_, State) -> {noreply, State}. handle_info({'EXIT', Pid, Reason}, State) when State#state.pid =:= Pid -> - report_error(child_terminated, Reason, State), + case Reason of + normal -> + ok; + shutdown -> + ok; + {shutdown, _Term} -> + ok; + _ -> + report_error(child_terminated, Reason, State) + end, {stop, Reason, State#state{pid = undefined}}; handle_info(_, State) -> {noreply, State}. -- cgit v1.2.3