summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTristan Sloughter <t@crashfast.com>2015-06-25 10:32:47 -0500
committerTristan Sloughter <t@crashfast.com>2015-06-25 10:32:47 -0500
commitb44867db072da8243ed230a3d82c2a3f8c5bfcf4 (patch)
tree30f5b008e190c1b6fb3876b6ef6d0e6955dff87e /src
parentf8bb088305f8ce0373e496dbd17ff5a1cfbdec3e (diff)
error message for bad profile config
Diffstat (limited to 'src')
-rw-r--r--src/rebar_state.erl14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/rebar_state.erl b/src/rebar_state.erl
index 8125026..d0b28de 100644
--- a/src/rebar_state.erl
+++ b/src/rebar_state.erl
@@ -4,6 +4,8 @@
get/2, get/3, set/3,
+ format_error/1,
+
has_all_artifacts/1,
code_paths/2, code_paths/3, update_code_paths/3,
@@ -166,6 +168,9 @@ default(#state_t{default=Opts}) ->
default(State, Opts) ->
State#state_t{default=Opts}.
+format_error({profile_not_list, Profile, Other}) ->
+ io_lib:format("Profile config must be a list but for profile '~p' config given as:~n~p", [Profile, Other]).
+
-spec has_all_artifacts(rebar_app_info:t()) -> true | providers:error().
has_all_artifacts(State) ->
Artifacts = rebar_state:get(State, artifacts, []),
@@ -291,8 +296,13 @@ apply_profiles(State=#state_t{default = Defaults, current_profiles=CurrentProfil
lists:foldl(fun(default, OptsAcc) ->
OptsAcc;
(Profile, OptsAcc) ->
- ProfileOpts = dict:from_list(proplists:get_value(Profile, ConfigProfiles, [])),
- merge_opts(Profile, ProfileOpts, OptsAcc)
+ case proplists:get_value(Profile, ConfigProfiles, []) of
+ OptsList when is_list(OptsList) ->
+ ProfileOpts = dict:from_list(OptsList),
+ merge_opts(Profile, ProfileOpts, OptsAcc);
+ Other ->
+ throw(?PRV_ERROR({profile_not_list, Profile, Other}))
+ end
end, Defaults, AppliedProfiles),
State#state_t{current_profiles = AppliedProfiles, opts=NewOpts}.