aboutsummaryrefslogtreecommitdiffstats
path: root/src/relcool.erl
diff options
context:
space:
mode:
authorEric <[email protected]>2012-12-06 18:12:53 -0500
committerJordan Wilberding <[email protected]>2012-12-07 05:49:59 -0700
commit819690cd8bda0f7f91740b8fa5df71256656de52 (patch)
treeb5e1d71e7935e0f1f3a9118638e05c574f8a63aa /src/relcool.erl
parentd88598d9748c89a7f3d041e078bc8e2b544b5da9 (diff)
downloadrelx-819690cd8bda0f7f91740b8fa5df71256656de52.tar.gz
relx-819690cd8bda0f7f91740b8fa5df71256656de52.tar.bz2
relx-819690cd8bda0f7f91740b8fa5df71256656de52.zip
fix nasty bug that didn't let relcool output errors
Signed-off-by: Jordan Wilberding <[email protected]>
Diffstat (limited to 'src/relcool.erl')
-rw-r--r--src/relcool.erl18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/relcool.erl b/src/relcool.erl
index 1c3ec02..0d75c62 100644
--- a/src/relcool.erl
+++ b/src/relcool.erl
@@ -128,14 +128,17 @@ run_providers(State0) ->
{ok, State1} ->
Providers = rcl_state:providers(State1),
Result = run_providers(ConfigProvider, Providers, State1),
- case rcl_state:caller(State1) of
- command_line ->
- init:stop(0);
- api ->
- Result
- end
+ handle_output(State1, rcl_state:caller(State1), Result)
end.
+handle_output(State, command_line, E={error, _}) ->
+ report_error(State, E),
+ init:stop(127);
+handle_output(_State, command_line, _) ->
+ init:stop(0);
+handle_output(_State, api, Result) ->
+ Result.
+
run_providers(ConfigProvider, Providers, State0) ->
case Providers of
[ConfigProvider | Rest] ->
@@ -151,10 +154,13 @@ run_providers(ConfigProvider, Providers, State0) ->
run_provider(_Provider, Error = {error, _}) ->
Error;
run_provider(Provider, {ok, State0}) ->
+ rcl_log:debug(rcl_state:log(State0), "Running provider ~p~n",
+ [rcl_provider:impl(Provider)]),
case rcl_provider:do(Provider, State0) of
{ok, State1} ->
{ok, State1};
E={error, _} ->
+
E
end.