diff options
author | Zandra Hird <[email protected]> | 2015-02-27 12:20:21 +0100 |
---|---|---|
committer | Zandra Hird <[email protected]> | 2015-02-27 12:20:48 +0100 |
commit | 4f856c3667dfe7b5ddfedea5035120d85cd001dc (patch) | |
tree | bb4fdf8955b1f7cb74720edcc40daee50356e70c /lib/kernel/src/application_controller.erl | |
parent | 6479cc440543c6bde87769a33b89a6d082aa28cf (diff) | |
parent | 7a8b845f6ff3e0646a9ca35352eda23cfa4dd656 (diff) | |
download | otp-4f856c3667dfe7b5ddfedea5035120d85cd001dc.tar.gz otp-4f856c3667dfe7b5ddfedea5035120d85cd001dc.tar.bz2 otp-4f856c3667dfe7b5ddfedea5035120d85cd001dc.zip |
Merge branch 'rokob/eliminate-duplication-app-controller' into maint
* rokob/eliminate-duplication-app-controller:
Add helper function to reduce code duplication
OTP-12524
Diffstat (limited to 'lib/kernel/src/application_controller.erl')
-rw-r--r-- | lib/kernel/src/application_controller.erl | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/kernel/src/application_controller.erl b/lib/kernel/src/application_controller.erl index daad45b6c2..6635885aaf 100644 --- a/lib/kernel/src/application_controller.erl +++ b/lib/kernel/src/application_controller.erl @@ -1615,7 +1615,6 @@ conv([Key, Val | T]) -> [{make_term(Key), make_term(Val)} | conv(T)]; conv(_) -> []. -%%% Fix some day: eliminate the duplicated code here make_term(Str) -> case erl_scan:string(Str) of {ok, Tokens, _} -> @@ -1623,16 +1622,17 @@ make_term(Str) -> {ok, Term} -> Term; {error, {_,M,Reason}} -> - error_logger:format("application_controller: ~ts: ~ts~n", - [M:format_error(Reason), Str]), - throw({error, {bad_environment_value, Str}}) + handle_make_term_error(M, Reason, Str) end; {error, {_,M,Reason}, _} -> - error_logger:format("application_controller: ~ts: ~ts~n", - [M:format_error(Reason), Str]), - throw({error, {bad_environment_value, Str}}) + handle_make_term_error(M, Reason, Str) end. +handle_make_term_error(Mod, Reason, Str) -> + error_logger:format("application_controller: ~ts: ~ts~n", + [Mod:format_error(Reason), Str]), + throw({error, {bad_environment_value, Str}}). + get_env_i(Name, #state{conf_data = ConfData}) when is_list(ConfData) -> case lists:keyfind(Name, 1, ConfData) of {_Name, Env} -> Env; |