Exception: Kokkai::Error

Inherits:
StandardError
  • Object
show all
Defined in:
lib/kokkai/error.rb

Constant Summary collapse

ClientError =
Class.new(self)
BadRequest =
Class.new(ClientError)
ERRORS =
{
  400 => Kokkai::Error::BadRequest
}.freeze
ATTRIBUTES =
%w(data diagnostics diagnostic)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, code) ⇒ Error

Returns a new instance of Error.



39
40
41
42
# File 'lib/kokkai/error.rb', line 39

def initialize(message, code)
  super(message)
  @code = code
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



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

def code
  @code
end

Class Method Details

.from_response(body) ⇒ Object



15
16
17
18
# File 'lib/kokkai/error.rb', line 15

def from_response(body)
  message, code = parse_error(body)
  new(message, code)
end