Exception: Exacto::Error

Inherits:
Exception
  • Object
show all
Defined in:
lib/exacto_subscriber/error.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, msg) ⇒ Error

Returns a new instance of Error.



4
5
6
7
8
# File 'lib/exacto_subscriber/error.rb', line 4

def initialize(code, msg)
  @code = code
  @message = msg
  super("Exacto Error: #{code} - #{msg}")
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/exacto_subscriber/error.rb', line 3

def code
  @code
end

#messsageObject (readonly)

Returns the value of attribute messsage.



3
4
5
# File 'lib/exacto_subscriber/error.rb', line 3

def messsage
  @messsage
end

Class Method Details

.from_response(response) ⇒ Object



10
11
12
13
14
# File 'lib/exacto_subscriber/error.rb', line 10

def self.from_response(response)
  if response && code = response["error"]
    raise new(code, response["error_description"])
  end
end