Exception: Cisco::CiscoError

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/cisco_node_utils/exceptions.rb

Overview

Generic class for exceptions raised by this module

Direct Known Subclasses

ClientError, RequestFailed, UnsupportedError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message = nil, **kwargs) ⇒ CiscoError

Returns a new instance of CiscoError


33
34
35
36
# File 'lib/cisco_node_utils/exceptions.rb', line 33

def initialize(message=nil, **kwargs)
  @kwargs = kwargs
  super(message)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_sym, *args, **kwargs, &block) ⇒ Object


42
43
44
# File 'lib/cisco_node_utils/exceptions.rb', line 42

def method_missing(method_sym, *args, **kwargs, &block)
  @kwargs.key?(method_sym) ? @kwargs[method_sym] : super
end

Instance Attribute Details

#kwargsObject (readonly)

Returns the value of attribute kwargs


31
32
33
# File 'lib/cisco_node_utils/exceptions.rb', line 31

def kwargs
  @kwargs
end

Instance Method Details

#respond_to?(method_sym, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)

38
39
40
# File 'lib/cisco_node_utils/exceptions.rb', line 38

def respond_to?(method_sym, include_private=false)
  @kwargs.key?(method_sym) ? true : super
end