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

Returns a new instance of 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

#headersHash? (readonly)

The HTTP response headers, if any.

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

Returns:

  • (Hash, nil)

    the response headers, or nil if not available



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

def headers
  @headers
end

#messageString (readonly)

The response body, if any.

Returns:

  • (String)


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

def message
  @message
end

#statusInt (readonly)

The HTTP status code.

Returns:

  • (Int)


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

def status
  @status
end