Exception: SSE::Errors::HTTPStatusError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/ld-eventsource/errors.rb

Overview

An exception class representing an HTTP error response. This can be passed to the error handler specified in Client#on_error.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status, message, headers = nil) ⇒ HTTPStatusError



12
13
14
15
16
17
# File 'lib/ld-eventsource/errors.rb', line 12

def initialize(status, message, headers = nil)
  @status = status
  @message = message
  @headers = headers
  super("HTTP error #{status}")
end

Instance Attribute Details

#headers ⇒ Hash? (readonly)

The HTTP response headers, if any.

The headers object uses case-insensitive keys (via the http gem's HTTP::Headers).



32
33
34
# File 'lib/ld-eventsource/errors.rb', line 32

def headers
  @headers
end

#message ⇒ String (readonly)

The response body, if any.



25
26
27
# File 'lib/ld-eventsource/errors.rb', line 25

def message
  @message
end

#status ⇒ Int (readonly)

The HTTP status code.



21
22
23
# File 'lib/ld-eventsource/errors.rb', line 21

def status
  @status
end