aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/agent/snmpa_trap.erl
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2012-01-24 13:49:45 +0100
committerMicael Karlberg <[email protected]>2012-01-24 13:49:45 +0100
commit8ae3c543864bfe62b80667a950340281e9fb79f3 (patch)
treeba992366873ba156a5da06e7f27ddebf3ab2727e /lib/snmp/src/agent/snmpa_trap.erl
parent7619b94a2c1098cbd176507b34d291806833a4b7 (diff)
parente0e862b42d508b5112395f41584bed90c74a8a92 (diff)
downloadotp-8ae3c543864bfe62b80667a950340281e9fb79f3.tar.gz
otp-8ae3c543864bfe62b80667a950340281e9fb79f3.tar.bz2
otp-8ae3c543864bfe62b80667a950340281e9fb79f3.zip
[snmp] Merged from R13B and also fixed appup
Merge from R13B maintenance branch (snmp-4.17.3), fixed appup and source diff (there is some between snmp-4.17.3 and 4.21.6). Merge branch 'maint-r13' into bmk/snmp/snmp4216_integration/r14 Conflicts: lib/snmp/doc/src/notes.xml lib/snmp/src/agent/snmpa.erl lib/snmp/src/agent/snmpa_agent.erl lib/snmp/src/agent/snmpa_trap.erl lib/snmp/src/app/snmp.appup.src lib/snmp/test/snmp_agent_test.erl lib/snmp/vsn.mk
Diffstat (limited to 'lib/snmp/src/agent/snmpa_trap.erl')
-rw-r--r--lib/snmp/src/agent/snmpa_trap.erl21
1 files changed, 18 insertions, 3 deletions
diff --git a/lib/snmp/src/agent/snmpa_trap.erl b/lib/snmp/src/agent/snmpa_trap.erl
index 5b579efc13..994d926224 100644
--- a/lib/snmp/src/agent/snmpa_trap.erl
+++ b/lib/snmp/src/agent/snmpa_trap.erl
@@ -352,11 +352,26 @@ send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs, ExtraInfo, NetIf) ->
send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs,
LocalEngineID, ExtraInfo, NetIf).
+%% The agent normally does not care about the result,
+%% but since it can be usefull when debugging, add
+%% some info when we fail to send the trap(s).
send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs, LocalEngineID,
ExtraInfo, NetIf) ->
- (catch do_send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs,
- LocalEngineID, ExtraInfo, NetIf)).
-
+ try
+ begin
+ do_send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs,
+ LocalEngineID, ExtraInfo, NetIf)
+ end
+ catch
+ T:E ->
+ Info = [{args, [TrapRec, NotifyName, ContextName,
+ Recv, Vbs, LocalEngineID, ExtraInfo, NetIf]},
+ {tag, T},
+ {err, E},
+ {stacktrace, erlang:get_stacktrace()}],
+ {error, {failed_sending_trap, Info}}
+ end.
+
do_send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs,
LocalEngineID, ExtraInfo, NetIf) ->
VarbindList = make_varbind_list(Vbs),