From c8d0aa46c40832fcc5c0ae6d8ea2c8fd67c53690 Mon Sep 17 00:00:00 2001 From: Tristan Sloughter Date: Mon, 2 Feb 2015 18:24:24 -0600 Subject: clean up create_logic_providers function --- src/rebar_state.erl | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/rebar_state.erl b/src/rebar_state.erl index 42caa5b..29b7c3f 100644 --- a/src/rebar_state.erl +++ b/src/rebar_state.erl @@ -278,8 +278,8 @@ add_provider(State=#state_t{providers=Providers}, Provider) -> State#state_t{providers=[Provider | Providers]}. create_logic_providers(ProviderModules, State0) -> - State1 = try - lists:foldl(fun(ProviderMod, StateAcc) -> + try + State1 = lists:foldl(fun(ProviderMod, StateAcc) -> case providers:new(ProviderMod, StateAcc) of {error, Reason} -> ?ERROR(Reason++"~n", []), @@ -287,13 +287,13 @@ create_logic_providers(ProviderModules, State0) -> {ok, StateAcc1} -> StateAcc1 end - end, State0, ProviderModules) - catch - C:T -> - ?DEBUG("~p: ~p ~p", [C, T, erlang:get_stacktrace()]), - throw({error, "Failed creating providers. Run with DEBUG=1 for stacktrace."}) - end, - apply_hooks(State1). + end, State0, ProviderModules), + apply_hooks(State1) + catch + C:T -> + ?DEBUG("~p: ~p ~p", [C, T, erlang:get_stacktrace()]), + throw({error, "Failed creating providers. Run with DEBUG=1 for stacktrace."}) + end. apply_hooks(State0) -> try -- cgit v1.1