Exception: SimpleProxiesDeployingException
- Inherits:
-
StandardError
- Object
- StandardError
- SimpleProxiesDeployingException
- Defined in:
- lib/simpleproxiesdeployingexception.rb
Constant Summary collapse
- ERROR_CODES =
[ { :code => 1, :description => 'Host has not SSH parameters' }, { :code => 2, :description => 'Proxy port is not a valid port' }, { :code => 3, :description => 'No SSH connection' }, { :code => 4, :description => 'SSH connection failed' }, { :code => 5, :description => 'IPv6 subnet /48 is not defined for this host' }, { :code => 6, :description => 'Extenral IP is not belonging the IPv6 subnet /48 defined for this host' }, { :code => 7, :description => 'More than 1 external IP defined for this proxy port' }, { :code => 8, :description => 'There is not external IP defined for this proxy port' }, # ports batch validations { :code => 9, :description => "By now proxy_port_from must be #{DEFAULT_PROXY_PORT_FROM}" }, { :code => 10, :description => "proxy_port_to must be higher than proxy_port_from" }, { :code => 11, :description => "[proxy_port_from..proxy_port_to] must be mod of batch size #{DEFAULT_PROXY_PORTS_BATCH_SIZE}" }, { :code => 12, :description => "Other proxies are belonging the same /64 subnet" }, { :code => 13, :description => "Each batch of 50 ports must be all configured or all empty" }, { :code => 14, :description => "Ports outside the range found" }, ]
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#custom_description ⇒ Object
Returns the value of attribute custom_description.
Class Method Summary collapse
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(the_code, the_custom_description = nil) ⇒ SimpleProxiesDeployingException
constructor
A new instance of SimpleProxiesDeployingException.
- #simple_description ⇒ Object
Constructor Details
#initialize(the_code, the_custom_description = nil) ⇒ SimpleProxiesDeployingException
Returns a new instance of SimpleProxiesDeployingException.
38 39 40 41 |
# File 'lib/simpleproxiesdeployingexception.rb', line 38 def initialize(the_code, the_custom_description = nil) self.code = the_code self.custom_description = the_custom_description.nil? ? nil : "#{SimpleProxiesDeployingException.description(self.code)}: #{the_custom_description}" end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
2 3 4 |
# File 'lib/simpleproxiesdeployingexception.rb', line 2 def code @code end |
#custom_description ⇒ Object
Returns the value of attribute custom_description.
2 3 4 |
# File 'lib/simpleproxiesdeployingexception.rb', line 2 def custom_description @custom_description end |
Class Method Details
.description(code) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/simpleproxiesdeployingexception.rb', line 23 def self.description(code) ERROR_CODES.each do |error_code| return error_code[:description] if error_code[:code] == code end return 'Unknown error code' end |
Instance Method Details
#description ⇒ Object
34 35 36 |
# File 'lib/simpleproxiesdeployingexception.rb', line 34 def description self.custom_description.nil? ? self.simple_description : self.custom_description end |
#simple_description ⇒ Object
30 31 32 |
# File 'lib/simpleproxiesdeployingexception.rb', line 30 def simple_description self.class.description(self.code) end |