aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/agent/snmpa_trap.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2012-01-25 15:21:09 +0100
committerErlang/OTP <[email protected]>2012-01-25 15:21:09 +0100
commit61fa5c03369e9ae6de2b4ae24438c236df93d7cb (patch)
tree4968c9941f15d3562a74b8138ec7e8e9d3daadcc /lib/snmp/src/agent/snmpa_trap.erl
parenta8af5a6bae97ddd7bfc2bcff2e701fa37f47640c (diff)
parent8d8d0a6529874345f3bb69349f573a75a73ea373 (diff)
downloadotp-61fa5c03369e9ae6de2b4ae24438c236df93d7cb.tar.gz
otp-61fa5c03369e9ae6de2b4ae24438c236df93d7cb.tar.bz2
otp-61fa5c03369e9ae6de2b4ae24438c236df93d7cb.zip
Merge branch 'bmk/snmp/snmp4216_integration/r15' into maint-r15
* bmk/snmp/snmp4216_integration/r15: [snmp] Releasse notes cleanup [snmp/agent] Incorrect mib server cache gclimit update [snmp] Updated doc and fixed wrequest create macros [snmp] Be more verbose in the worker procs [snmp] Add a more informative return value when the trap sending fails [snmp] Fixed the mt_trap test-case [snmp] Maximum number of varbinds in a Get-BULK response [snmp] Correted the expect bug in the snmp test utility [snmp] Mostly added some more verbosity stuff
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),