aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSiri Hansen <[email protected]>2012-10-11 11:50:40 +0200
committerSiri Hansen <[email protected]>2012-10-11 11:50:40 +0200
commit95af7e7bec94d9ee2ba7cbbe4aa045862ddcd386 (patch)
tree3c692356fb425a33eb9009f85eca8c63cdf782f8
parent102adf32f766dceee6f277c34111fbe9b8971647 (diff)
downloadotp-95af7e7bec94d9ee2ba7cbbe4aa045862ddcd386.tar.gz
otp-95af7e7bec94d9ee2ba7cbbe4aa045862ddcd386.tar.bz2
otp-95af7e7bec94d9ee2ba7cbbe4aa045862ddcd386.zip
If supervisor:start_link fails to start child, add child id to error reason
-rw-r--r--lib/stdlib/src/supervisor.erl3
-rw-r--r--lib/stdlib/test/supervisor_SUITE.erl27
2 files changed, 19 insertions, 11 deletions
diff --git a/lib/stdlib/src/supervisor.erl b/lib/stdlib/src/supervisor.erl
index 7624c6cd18..9f93747c3e 100644
--- a/lib/stdlib/src/supervisor.erl
+++ b/lib/stdlib/src/supervisor.erl
@@ -297,7 +297,8 @@ start_children([Child|Chs], NChildren, SupName) ->
start_children(Chs, [Child#child{pid = Pid}|NChildren], SupName);
{error, Reason} ->
report_error(start_error, Reason, Child, SupName),
- {error, lists:reverse(Chs) ++ [Child | NChildren], Reason}
+ {error, lists:reverse(Chs) ++ [Child | NChildren],
+ {failed_to_start_child,Child#child.name,Reason}}
end;
start_children([], NChildren, _SupName) ->
{ok, NChildren}.
diff --git a/lib/stdlib/test/supervisor_SUITE.erl b/lib/stdlib/test/supervisor_SUITE.erl
index d9f2e82b31..569c66959e 100644
--- a/lib/stdlib/test/supervisor_SUITE.erl
+++ b/lib/stdlib/test/supervisor_SUITE.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2011. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2012. All Rights Reserved.
%%
%% The contents of this file are subject to the Erlang Public License,
%% Version 1.1, (the "License"); you may not use this file except in
@@ -671,17 +671,24 @@ faulty_application_shutdown(Config) when is_list(Config) ->
%% Start faulty app
code:add_patha(EbinDir),
- % {error,
- % {{shutdown,
- % {undef,[
- % {an_undefined_module_with,an_undefined_function,[argument1,argument2],[]},
- % {app_faulty_server,init,1,[{file,"app_faulty/src/app_faulty_server.erl"},{line,16}]},
- % {gen_server,init_it,6,[{file,"gen_server.erl"},{line,304}]},
- % {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,227}]}
- % ]}},{app_faulty,start,[normal,[]]}}}
+ %% {error,
+ %% {{shutdown,
+ %% {failed_to_start_child,
+ %% app_faulty,
+ %% {undef,
+ %% [{an_undefined_module_with,an_undefined_function,[argument1,argument2],
+ %% []},
+ %% {app_faulty_server,init,1,
+ %% [{file,"app_faulty/src/app_faulty_server.erl"},{line,16}]},
+ %% {gen_server,init_it,6,
+ %% [{file,"gen_server.erl"},{line,304}]},
+ %% {proc_lib,init_p_do_apply,3,
+ %% [{file,"proc_lib.erl"},{line,227}]}]}}},
+ %% {app_faulty,start,[normal,[]]}}}
{error, Error} = application:start(app_faulty),
- {{shutdown, {undef, CallStack}},{app_faulty,start,_}} = Error,
+ {{shutdown, {failed_to_start_child,app_faulty,{undef, CallStack}}},
+ {app_faulty,start,_}} = Error,
[{an_undefined_module_with,an_undefined_function,_,_}|_] = CallStack,
ok = application:unload(app_faulty),
ok.