Exception: LineChange::APIError

Inherits:
Error
  • Object
show all
Defined in:
lib/line_change/errors.rb

Overview

API errors

Direct Known Subclasses

ClientError, ServerError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args) ⇒ APIError

Returns a new instance of APIError.



8
9
10
11
12
13
14
15
16
17
# File 'lib/line_change/errors.rb', line 8

def initialize(args)
  @status, @headers, @body = args[:status], args[:headers], parse_json(args[:body])

  message =
    body['message'] ||
    (body['errors'] && convert_hash_to_message(body['errors'])) ||
    body

  super(message)
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



6
7
8
# File 'lib/line_change/errors.rb', line 6

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



6
7
8
# File 'lib/line_change/errors.rb', line 6

def headers
  @headers
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/line_change/errors.rb', line 6

def status
  @status
end