Exception: Ki::ApiError

Inherits:
StandardError
  • Object
show all
Extended by:
Descendants
Defined in:
lib/ki/utils/api_error.rb

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Descendants

descendants

Constructor Details

#initialize(body = nil, status = 400) ⇒ ApiError

Returns a new instance of ApiError.



9
10
11
12
# File 'lib/ki/utils/api_error.rb', line 9

def initialize(body = nil, status = 400)
  super body.nil? ? to_s : body
  @status = status
end

Instance Attribute Details

#statusObject (readonly)

Returns the value of attribute status.



7
8
9
# File 'lib/ki/utils/api_error.rb', line 7

def status
  @status
end

Instance Method Details

#resultObject



14
15
16
17
18
19
# File 'lib/ki/utils/api_error.rb', line 14

def result
  {
    'error' => to_s,
    'status' => @status
  }
end