diff options
author | Björn Gustavsson <[email protected]> | 2017-05-11 12:51:04 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2017-05-11 12:51:04 +0200 |
commit | c3a81d86c0ad0245cd47ff17aee70dc816c07e39 (patch) | |
tree | f21ea993bd379ebb960bc896c15532aae9e00f09 /lib/snmp/src/agent/snmp_generic.erl | |
parent | 5aa7180ae0ad7a34d1903003cbcd4a7d5cc61858 (diff) | |
parent | 5d7e12f4d037f74602029850bbd29e38c3732b48 (diff) | |
download | otp-c3a81d86c0ad0245cd47ff17aee70dc816c07e39.tar.gz otp-c3a81d86c0ad0245cd47ff17aee70dc816c07e39.tar.bz2 otp-c3a81d86c0ad0245cd47ff17aee70dc816c07e39.zip |
Merge pull request #1449 from bjorng/bjorn/future-proof-exceptions
Make calls to get_stacktrace/0 future-proof
OTP-14400
Diffstat (limited to 'lib/snmp/src/agent/snmp_generic.erl')
-rw-r--r-- | lib/snmp/src/agent/snmp_generic.erl | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/lib/snmp/src/agent/snmp_generic.erl b/lib/snmp/src/agent/snmp_generic.erl index fc23e16ef1..4738525341 100644 --- a/lib/snmp/src/agent/snmp_generic.erl +++ b/lib/snmp/src/agent/snmp_generic.erl @@ -413,20 +413,21 @@ table_check_status(NameDb, Col, ?'RowStatus_createAndGo', RowIndex, Cols) -> false -> % it's ok to use snmpa_local_db:table_construct_row since it's % side effect free and we only use the result temporary. - case catch snmpa_local_db:table_construct_row( + try snmpa_local_db:table_construct_row( NameDb, RowIndex, ?'RowStatus_createAndGo', Cols) of - {'EXIT', _Reason} -> - ?vtrace( - "failed construct row (createAndGo): " - " n Reason: ~p" - " n Stack: ~p", - [_Reason, erlang:get_stacktrace()]), - {noCreation, Col}; % Bad RowIndex Row -> case lists:member(noinit, tuple_to_list(Row)) of false -> {noError, 0}; _Found -> {inconsistentValue, Col} end + catch + _:_Reason -> + ?vtrace( + "failed construct row (createAndGo): " + " n Reason: ~p" + " n Stack: ~p", + [_Reason, erlang:get_stacktrace()]), + {noCreation, Col} % Bad RowIndex end; true -> {inconsistentValue, Col} end; @@ -435,17 +436,18 @@ table_check_status(NameDb, Col, ?'RowStatus_createAndGo', RowIndex, Cols) -> table_check_status(NameDb, Col, ?'RowStatus_createAndWait', RowIndex, Cols) -> case table_row_exists(NameDb, RowIndex) of false -> - case catch snmpa_local_db:table_construct_row( + try snmpa_local_db:table_construct_row( NameDb, RowIndex, ?'RowStatus_createAndGo', Cols) of - {'EXIT', _Reason} -> + _Row -> + {noError, 0} + catch + _:_Reason -> ?vtrace( "failed construct row (createAndWait): " " n Reason: ~p" " n Stack: ~p", [_Reason, erlang:get_stacktrace()]), - {noCreation, Col}; % Bad RowIndex - _Row -> - {noError, 0} + {noCreation, Col} % Bad RowIndex end; true -> {inconsistentValue, Col} end; |