Method: Lightstreamer::PostRequest.parse_error

Defined in:
lib/lightstreamer/post_request.rb

.parse_error(response_lines) ⇒ LightstreamerError?

Parses the next error from the given lines that were returned by a POST request. The consumed lines are removed from the passed array.

Parameters:

  • response_lines (Array<String>)

Returns:



68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/lightstreamer/post_request.rb', line 68

def parse_error(response_lines)
  first_line = response_lines.shift

  return nil if first_line == 'OK'
  return Errors::SyncError.new if first_line == 'SYNC ERROR'

  if first_line == 'ERROR'
    error_code = response_lines.shift
    LightstreamerError.build response_lines.shift, error_code
  else
    LightstreamerError.new first_line
  end
end