aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mnesia/src/mnesia.hrl
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.hrl
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.hrl')
-rw-r--r--lib/mnesia/src/mnesia.hrl7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/mnesia/src/mnesia.hrl b/lib/mnesia/src/mnesia.hrl
index c8010d5466..fa0258cf20 100644
--- a/lib/mnesia/src/mnesia.hrl
+++ b/lib/mnesia/src/mnesia.hrl
@@ -39,7 +39,12 @@
-define(ets_delete_table(Tab), ets:delete(Tab)).
-define(ets_fixtable(Tab, Bool), ets:fixtable(Tab, Bool)).
--define(catch_val(Var), (catch ?ets_lookup_element(mnesia_gvar, Var, 2))).
+
+-define(SAFE(OP), try (OP) catch error:_ -> ok end).
+-define(CATCH(OP), try (OP) catch _:_Reason -> {'EXIT', _Reason} end).
+
+-define(catch_val(Var), (try ?ets_lookup_element(mnesia_gvar, Var, 2)
+ catch error:_ -> {'EXIT', {badarg, []}} end)).
%% It's important that counter is first, since we compare tid's