aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mnesia/src/mnesia_snmp_hook.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2014-04-29 10:09:08 +0200
committerDan Gudmundsson <[email protected]>2015-03-27 13:15:24 +0100
commita83bf960f1018217d7f3c9c8387a37722aa93fc6 (patch)
treefddad434266d4af2e4835d4b071be9a4c798f5ec /lib/mnesia/src/mnesia_snmp_hook.erl
parentbb7642ee5f326b25425634cfc40baa385f5ab3fa (diff)
downloadotp-a83bf960f1018217d7f3c9c8387a37722aa93fc6.tar.gz
otp-a83bf960f1018217d7f3c9c8387a37722aa93fc6.tar.bz2
otp-a83bf960f1018217d7f3c9c8387a37722aa93fc6.zip
mnesia: Replace catch with try-catch
Avoids building stacktraces where it is not needed and do not mask errors, i.e. only catch the relevant classes in each try.
Diffstat (limited to 'lib/mnesia/src/mnesia_snmp_hook.erl')
-rw-r--r--lib/mnesia/src/mnesia_snmp_hook.erl17
1 files changed, 4 insertions, 13 deletions
diff --git a/lib/mnesia/src/mnesia_snmp_hook.erl b/lib/mnesia/src/mnesia_snmp_hook.erl
index 256f83b029..c76cf89ebb 100644
--- a/lib/mnesia/src/mnesia_snmp_hook.erl
+++ b/lib/mnesia/src/mnesia_snmp_hook.erl
@@ -30,15 +30,6 @@
-include("mnesia.hrl").
-val(Var) ->
- case ?catch_val(Var) of
- {'EXIT', _ReASoN_} ->
- case mnesia_lib:other_val(Var) of
- error -> mnesia_lib:pr_other(Var, _ReASoN_);
- Val -> Val
- end;
- _VaLuE_ -> _VaLuE_
- end.
check_ustruct([]) ->
true; %% default value, not SNMP'ified
@@ -85,12 +76,12 @@ delete_table(_MnesiaTab, Tree) ->
%%-----------------------------------------------------------------
update({clear_table, MnesiaTab}) ->
- Tree = val({MnesiaTab, {index, snmp}}),
+ Tree = mnesia_lib:val({MnesiaTab, {index, snmp}}),
b_clear(Tree),
ok;
update({Op, MnesiaTab, MnesiaKey, SnmpKey}) ->
- Tree = val({MnesiaTab, {index, snmp}}),
+ Tree = mnesia_lib:val({MnesiaTab, {index, snmp}}),
update(Op, Tree, MnesiaKey, SnmpKey).
update(Op, Tree, MnesiaKey, SnmpKey) ->
@@ -120,7 +111,7 @@ update(Op, Tree, MnesiaKey, SnmpKey) ->
%%-----------------------------------------------------------------
key_to_oid(Tab,Key) ->
- Types = val({Tab,snmp}),
+ Types = mnesia_lib:val({Tab,snmp}),
key_to_oid(Tab, Key, Types).
key_to_oid(Tab, Key, [{key, Types}]) ->
@@ -144,7 +135,7 @@ keys_to_oid(N, Key, Oid, Types) ->
%% This can be lookup up in tree but that might be on a remote node.
%% It's probably faster to look it up, but use when it migth be remote
oid_to_key(Oid, Tab) ->
- [{key, Types}] = val({Tab,snmp}),
+ [{key, Types}] = mnesia_lib:val({Tab,snmp}),
oid_to_key_1(Types, Oid).
oid_to_key_1(integer, [Key]) -> Key;