Exception: Simplesol::Error

Inherits:
Exception
  • Object
show all
Defined in:
lib/simplesol/errors.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(response) ⇒ Error

Returns a new instance of Error.



11
12
13
14
# File 'lib/simplesol/errors.rb', line 11

def initialize(response)
  @code = response.error
  @message = response.message
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



9
10
11
# File 'lib/simplesol/errors.rb', line 9

def code
  @code
end

Class Method Details

.parse(response) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/simplesol/errors.rb', line 16

def self.parse(response)
  if response.error
    Simplesol::ERRORS[response.error].new response
  else
    Exception.new('error cannot be parsed')
  end
end