You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2024/02/12 23:36:21 UTC

(couchdb) 20/28: Revert "Use Default in config:get/3 on ets table error"

This is an automated email from the ASF dual-hosted git repository.

chewbranca pushed a commit to branch couch-stats-resource-tracker-rebase
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit d66ea32db33017698476fd1a35f159bfc3e4847a
Author: Russell Branca <ch...@apache.org>
AuthorDate: Thu Nov 30 15:08:58 2023 -0800

    Revert "Use Default in config:get/3 on ets table error"
    
    This reverts commit 4f00910a88e37e8a2b977814c0ecfe19f7f788af.
---
 src/config/src/config.erl | 23 +++++++++--------------
 1 file changed, 9 insertions(+), 14 deletions(-)

diff --git a/src/config/src/config.erl b/src/config/src/config.erl
index 3d0190cb0..417a104c5 100644
--- a/src/config/src/config.erl
+++ b/src/config/src/config.erl
@@ -156,20 +156,15 @@ get(Section, Key) ->
 get(Section, Key, Default) when is_binary(Section) and is_binary(Key) ->
     ?MODULE:get(binary_to_list(Section), binary_to_list(Key), Default);
 get(Section, Key, Default) when is_list(Section), is_list(Key) ->
-    try
-        case ets:lookup(?MODULE, {Section, Key}) of
-            [] when Default == undefined -> Default;
-            [] when is_boolean(Default) -> Default;
-            [] when is_float(Default) -> Default;
-            [] when is_integer(Default) -> Default;
-            [] when is_list(Default) -> Default;
-            [] when is_atom(Default) -> Default;
-            [] -> error(badarg);
-            [{_, Match}] -> Match
-        end
-    catch
-        error:badarg ->
-            Default
+    case ets:lookup(?MODULE, {Section, Key}) of
+        [] when Default == undefined -> Default;
+        [] when is_boolean(Default) -> Default;
+        [] when is_float(Default) -> Default;
+        [] when is_integer(Default) -> Default;
+        [] when is_list(Default) -> Default;
+        [] when is_atom(Default) -> Default;
+        [] -> error(badarg);
+        [{_, Match}] -> Match
     end.
 
 set(Section, Key, Value) ->