diff options
author | Fred Hebert <mononcqc@ferd.ca> | 2015-06-25 12:57:33 -0400 |
---|---|---|
committer | Fred Hebert <mononcqc@ferd.ca> | 2015-06-25 12:57:33 -0400 |
commit | 4f23b5c99d3269b622d04b0431aef16eb37b8d2e (patch) | |
tree | 30f5b008e190c1b6fb3876b6ef6d0e6955dff87e | |
parent | ee286ed4431f368011eaaf8cbe079b9ec617c8fa (diff) | |
parent | b44867db072da8243ed230a3d82c2a3f8c5bfcf4 (diff) |
Merge pull request #540 from tsloughter/bad_profile_config
error message for bad profile config, fixes #539
-rw-r--r-- | src/rebar_state.erl | 14 |
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}. |