Exception: Net::SNMP::Error

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

Direct Known Subclasses

TimeoutError

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Debug

#print_packet, #time

Constructor Details

#initialize(opts = {}) ⇒ Error

Returns a new instance of Error.



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

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.



6
7
8
# File 'lib/net/snmp/error.rb', line 6

def errno
  @errno
end

#snmp_errObject

Returns the value of attribute snmp_err.



6
7
8
# File 'lib/net/snmp/error.rb', line 6

def snmp_err
  @snmp_err
end

#snmp_msgObject

Returns the value of attribute snmp_msg.



6
7
8
# File 'lib/net/snmp/error.rb', line 6

def snmp_msg
  @snmp_msg
end

#statusObject

Returns the value of attribute status.



6
7
8
# File 'lib/net/snmp/error.rb', line 6

def status
  @status
end

Instance Method Details



18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/net/snmp/error.rb', line 18

def print
  message = <<-EOF

  SNMP Error: #{self.class.to_s}
  message = #{message}
  status = #{@status}
  errno = #{@errno}
  snmp_err = #{@snmp_err}
  snmp_msg = #{@snmp_msg}
  EOF

  error(message.gsub /^\s*/, '')
end