diff options
author | Micael Karlberg <[email protected]> | 2012-01-30 14:41:18 +0100 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2012-01-30 14:41:18 +0100 |
commit | 1408c848ef81651df1a8304d81948f6bb3b88eac (patch) | |
tree | a2096236c2faebefde94e31dfea6576ae493e958 /lib/snmp/src/agent/snmpa_trap.erl | |
parent | 6172fcb89bb8bfb136f9601336620b38d28930d9 (diff) | |
parent | 61fa5c03369e9ae6de2b4ae24438c236df93d7cb (diff) | |
download | otp-1408c848ef81651df1a8304d81948f6bb3b88eac.tar.gz otp-1408c848ef81651df1a8304d81948f6bb3b88eac.tar.bz2 otp-1408c848ef81651df1a8304d81948f6bb3b88eac.zip |
Merge branch 'maint-r15' into maint
Diffstat (limited to 'lib/snmp/src/agent/snmpa_trap.erl')
-rw-r--r-- | lib/snmp/src/agent/snmpa_trap.erl | 21 |
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), |