Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure all config get's throw on no ets table #4894

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/config/src/config.erl
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ all() ->
lists:sort(gen_server:call(?MODULE, all, infinity)).

get_integer(Section, Key, Default) when is_integer(Default) ->
Val = get(Section, Key, Default),
try
to_integer(get(Section, Key, Default))
to_integer(Val)
catch
error:badarg ->
Default
Expand All @@ -91,8 +92,9 @@ to_integer(Bin) when is_binary(Bin) ->
list_to_integer(binary_to_list(Bin)).

get_float(Section, Key, Default) when is_float(Default) ->
Val = get(Section, Key, Default),
try
to_float(get(Section, Key, Default))
to_float(Val)
catch
error:badarg ->
Default
Expand All @@ -116,8 +118,9 @@ to_float(Bin) when is_binary(Bin) ->
list_to_float(binary_to_list(Bin)).

get_boolean(Section, Key, Default) when is_boolean(Default) ->
Val = get(Section, Key, Default),
try
to_boolean(get(Section, Key, Default))
to_boolean(Val)
catch
error:badarg ->
Default
Expand Down