aboutsummaryrefslogtreecommitdiffstats
path: root/lib/snmp/src/agent/snmpa_trap.erl
diff options
context:
space:
mode:
authorErlang/OTP <[email protected]>2012-01-24 14:12:16 +0100
committerErlang/OTP <[email protected]>2012-01-24 14:12:16 +0100
commitb55c3d29a3d9efce2ce6548963809fc3b7ab8729 (patch)
treeb27cf0f5797c58df0fc5acc5da37683e341e5199 /lib/snmp/src/agent/snmpa_trap.erl
parent7619b94a2c1098cbd176507b34d291806833a4b7 (diff)
parente447fc699d91456597cd38c0949dbc3872015e88 (diff)
downloadotp-b55c3d29a3d9efce2ce6548963809fc3b7ab8729.tar.gz
otp-b55c3d29a3d9efce2ce6548963809fc3b7ab8729.tar.bz2
otp-b55c3d29a3d9efce2ce6548963809fc3b7ab8729.zip
Merge branch 'bmk/snmp/snmp4216_integration/r14' into maint-r14
* bmk/snmp/snmp4216_integration/r14: [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),