Exception: HOALife::HTTPError

Inherits:
Error
  • Object
show all
Defined in:
lib/hoalife/error.rb

Overview

HTTP Errors

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, headers, details) ⇒ HTTPError

Returns a new instance of HTTPError.



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/hoalife/error.rb', line 10

def initialize(status, headers, details)
  @status  = status
  @headers = headers

  begin
    @details = JSON.parse(details)
  rescue JSON::ParserError, TypeError
    @details = details
  end

  super(status)
end

Instance Attribute Details

#detailsObject (readonly)

Returns the value of attribute details.



8
9
10
# File 'lib/hoalife/error.rb', line 8

def details
  @details
end

#headersObject (readonly)

Returns the value of attribute headers.



8
9
10
# File 'lib/hoalife/error.rb', line 8

def headers
  @headers
end

#statusObject (readonly)

Returns the value of attribute status.



8
9
10
# File 'lib/hoalife/error.rb', line 8

def status
  @status
end