summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFred Hebert <mononcqc@ferd.ca>2015-03-16 15:35:13 -0400
committerFred Hebert <mononcqc@ferd.ca>2015-03-16 15:35:13 -0400
commit76143ec02921e91e4fc865d9b45617089f6526ad (patch)
tree8c4c395d785d876140ee3e290521473da1463bdd
parenteba1caca80b21cecf7b7ca697dbdaa1c08bb8b63 (diff)
parentcfd10b82f11c7931ebd5aac31821684e6c7fcd0a (diff)
Merge pull request #275 from tsloughter/pkg_vsn_error
handle bad package version with error message
-rw-r--r--src/rebar_prv_install_deps.erl4
-rw-r--r--src/rebar_prv_update.erl2
2 files changed, 4 insertions, 2 deletions
diff --git a/src/rebar_prv_install_deps.erl b/src/rebar_prv_install_deps.erl
index 48402da..59acb54 100644
--- a/src/rebar_prv_install_deps.erl
+++ b/src/rebar_prv_install_deps.erl
@@ -97,6 +97,8 @@ do(State) ->
end.
-spec format_error(any()) -> iolist().
+format_error({bad_constraint, Name, Constraint}) ->
+ io_lib:format("Unable to parse version for package ~s: ~s", [Name, Constraint]);
format_error({parse_dep, Dep}) ->
io_lib:format("Failed parsing dep ~p", [Dep]);
format_error({missing_package, Package, Version}) ->
@@ -510,7 +512,7 @@ parse_goal(Name, Constraint) ->
{match, [Op, Vsn]} ->
{Name, Vsn, binary_to_atom(Op, utf8)};
nomatch ->
- fail
+ throw(?PRV_ERROR({bad_constraint, Name, Constraint}))
end.
warn_skip_deps(AppInfo, State) ->
diff --git a/src/rebar_prv_update.erl b/src/rebar_prv_update.erl
index e851f7b..170c591 100644
--- a/src/rebar_prv_update.erl
+++ b/src/rebar_prv_update.erl
@@ -49,7 +49,7 @@ do(State) ->
ok
catch
_E:_C ->
- ?PRV_ERROR(package_index_write)
+ throw(?PRV_ERROR(package_index_write))
end,
{ok, State}.