lib/netdisco/snmp.rb in netdisco-0.0.4 vs lib/netdisco/snmp.rb in netdisco-0.0.5

- old
+ new

@@ -1,5 +1,7 @@ +# frozen_string_literal: true + require "snmp" class Netdisco class SNMP class NetdiscoError < StandardError; end @@ -72,11 +74,11 @@ end private def snmp(method, *args) @snmp.send method, *args - rescue ::SNMP::RequestTimeout, Errno::EACCES => error - msg = "host '#{@host}' raised '#{error.class}' with message '#{error.message}' for method '#{method}' with args '#{args}'" + rescue ::SNMP::RequestTimeout, Errno::EACCES => e + msg = "host '#{@host}' raised '#{e.class}' with message '#{e.message}' for method '#{method}' with args '#{args}'" Log.warn msg raise NoResponse, msg end # Hash with some helper methods to easier work with VarBinds