Exception: SSE::Errors::HTTPStatusError
- Inherits:
-
StandardError
- Object
- StandardError
- SSE::Errors::HTTPStatusError
- 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
-
#headers ⇒ Hash?
readonly
The HTTP response headers, if any.
-
#message ⇒ String
readonly
The response body, if any.
-
#status ⇒ Int
readonly
The HTTP status code.
Instance Method Summary collapse
-
#initialize(status, message, headers = nil) ⇒ HTTPStatusError
constructor
A new instance of HTTPStatusError.
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, , headers = nil) @status = status @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 end |
#status ⇒ Int (readonly)
The HTTP status code.
21 22 23 |
# File 'lib/ld-eventsource/errors.rb', line 21 def status @status end |