Exception: Lightstreamer::RequestError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/lightstreamer/request_error.rb

Overview

This error class is raised by Session when a request to the Lightstreamer API fails.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(error, http_code = nil) ⇒ RequestError

Initializes this request error with a message and an HTTP code.

Parameters:

  • error (String)

    The error description.

  • http_code (Integer) (defaults to: nil)

    The HTTP code for the request failure, if known.



14
15
16
17
18
19
# File 'lib/lightstreamer/request_error.rb', line 14

def initialize(error, http_code = nil)
  @error = error.to_s
  @http_code = http_code ? http_code.to_i : nil

  super "Request error: #{error}#{http_code ? ", http code: #{http_code}" : ''}"
end

Instance Attribute Details

#errorString (readonly)

Returns A description of the error that occurred when the request was attempted.

Returns:

  • (String)

    A description of the error that occurred when the request was attempted.



5
6
7
# File 'lib/lightstreamer/request_error.rb', line 5

def error
  @error
end

#http_codeFixnum (readonly)

Returns The HTTP code that was returned, or nil if unknown.

Returns:

  • (Fixnum)

    The HTTP code that was returned, or nil if unknown.



8
9
10
# File 'lib/lightstreamer/request_error.rb', line 8

def http_code
  @http_code
end