diff options
Diffstat (limited to 'src/rebar_prv_update.erl')
-rw-r--r-- | src/rebar_prv_update.erl | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl index 5180d4a..c885167 100644 --- a/src/rebar_prv_update.erl +++ b/src/rebar_prv_update.erl @@ -29,17 +29,21 @@ init(State) -> opts = []}), {ok, State1}. --spec do(rebar_state:t()) -> {ok, rebar_state:t()}. +-spec do(rebar_state:t()) -> {ok, rebar_state:t()} | {error, string()}. do(State) -> case rebar_state:command_args(State) of [Name] -> - ?ERROR("Updating ~s~n", [Name]), + ?INFO("Updating ~s~n", [Name]), Locks = rebar_state:get(State, locks, []), - {_, _, _, Level} = lists:keyfind(ec_cnv:to_binary(Name), 1, Locks), - Deps = rebar_state:get(State, deps), - Dep = lists:keyfind(list_to_atom(Name), 1, Deps), - rebar_prv_install_deps:handle_deps(State, [Dep], {true, ec_cnv:to_binary(Name), Level}), - {ok, State}; + case lists:keyfind(ec_cnv:to_binary(Name), 1, Locks) of + {_, _, _, Level} -> + Deps = rebar_state:get(State, deps), + Dep = lists:keyfind(list_to_atom(Name), 1, Deps), + rebar_prv_install_deps:handle_deps(State, [Dep], {true, ec_cnv:to_binary(Name), Level}), + {ok, State}; + false -> + {error, io_lib:format("No such dependency ~s~n", [Name])} + end; [] -> ?INFO("Updating package index...~n", []), Url = url(State), |