Exception: Net::SNMP::Error

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/net/snmp/error.rb

Direct Known Subclasses

TimeoutError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Error

Returns a new instance of Error.



5
6
7
8
9
10
11
12
13
14
# File 'lib/net/snmp/error.rb', line 5

def initialize(opts = {})
  @status = opts[:status]
  @fiber = opts[:fiber]
  if opts[:session]
    @errno = opts[:session].errno
    @snmp_err = opts[:session].snmp_err
    @snmp_msg = opts[:session].error_message
  end
  print
end

Instance Attribute Details

#errnoObject

Returns the value of attribute errno.



4
5
6
# File 'lib/net/snmp/error.rb', line 4

def errno
  @errno
end

#snmp_errObject

Returns the value of attribute snmp_err.



4
5
6
# File 'lib/net/snmp/error.rb', line 4

def snmp_err
  @snmp_err
end

#snmp_msgObject

Returns the value of attribute snmp_msg.



4
5
6
# File 'lib/net/snmp/error.rb', line 4

def snmp_msg
  @snmp_msg
end

#statusObject

Returns the value of attribute status.



4
5
6
# File 'lib/net/snmp/error.rb', line 4

def status
  @status
end

Instance Method Details



16
17
18
19
20
21
22
23
# File 'lib/net/snmp/error.rb', line 16

def print
  puts "SNMP Error: #{self.class.to_s}"
  puts "message = #{message}"
  puts "status = #{@status}"
  puts "errno = #{@errno}"
  puts "snmp_err = #{@snmp_err}"
  puts "snmp_msg = #{@snmp_msg}"
end