diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2012-04-30 16:01:39 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2012-04-30 16:01:39 +0100 |
commit | 170102611c47f8bafd7ebfd5a29a76803011e33c (patch) | |
tree | 38f08090cb5d60858282a52703ebd839e236fa76 | |
parent | 4d54f2cdbcfd272851a3835226616c436156c0a0 (diff) | |
download | rabbitmq-server-170102611c47f8bafd7ebfd5a29a76803011e33c.tar.gz |
Log errors when children fail to start.
-rw-r--r-- | src/mirrored_supervisor.erl | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mirrored_supervisor.erl b/src/mirrored_supervisor.erl index 221f6a87..c5f22c51 100644 --- a/src/mirrored_supervisor.erl +++ b/src/mirrored_supervisor.erl @@ -306,9 +306,9 @@ handle_call({init, Overall}, _From, Delegate = child(Overall, delegate), erlang:monitor(process, Delegate), State1 = State#state{overall = Overall, delegate = Delegate}, - case all_started([maybe_start(Group, Delegate, S) || S <- ChildSpecs]) of - true -> {reply, ok, State1}; - false -> {stop, shutdown, State1} + case errors([maybe_start(Group, Delegate, S) || S <- ChildSpecs]) of + [] -> {reply, ok, State1}; + Errors -> {stop, {shutdown, Errors}, State1} end; handle_call({start_child, ChildSpec}, _From, @@ -372,9 +372,9 @@ handle_info({'DOWN', _Ref, process, Pid, _Reason}, [start(Delegate, ChildSpec) || ChildSpec <- ChildSpecs]; _ -> [] end, - case all_started(R) of - true -> {noreply, State}; - false -> {stop, shutdown, State} + case errors(R) of + [] -> {noreply, State}; + Errors -> {stop, {shutdown, Errors}, State} end; handle_info(Info, State) -> @@ -468,7 +468,7 @@ delete_all(Group) -> [delete(Group, id(C)) || C <- mnesia:select(?TABLE, [{MatchHead, [], ['$1']}])]. -all_started(Results) -> [] =:= [R || R = {error, _} <- Results]. +errors(Results) -> [E || {error, E} <- Results]. %%---------------------------------------------------------------------------- |