Exception: Parse::LiveQuery::SubscriptionError
- Defined in:
- lib/parse/live_query.rb
Overview
Raised when the LiveQuery server rejects a subscribe request.
Carries the originating request_id (the client-assigned
sequence number used for op/error correlation on the same socket)
and the class_name the subscription targeted. Both are present
on Subscription#fail!-constructed instances; standalone
SubscriptionError.new("...") callers can omit them and the
message is preserved verbatim.
Mirrors the structure of Parse::Error::ProtocolError — the
error string contains the contextual prefix when the fields are
set so rescue SubscriptionError => e; e.message carries enough
for a single-line log line without inspecting e further.
Instance Attribute Summary collapse
-
#class_name ⇒ String?
readonly
Parse class the subscription was targeting.
-
#request_id ⇒ Integer?
readonly
Request id of the failed subscribe.
Attributes inherited from Error
Instance Method Summary collapse
-
#initialize(message_or_error, request_id: nil, class_name: nil) ⇒ SubscriptionError
constructor
A new instance of SubscriptionError.
Constructor Details
#initialize(message_or_error, request_id: nil, class_name: nil) ⇒ SubscriptionError
Returns a new instance of SubscriptionError.
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/parse/live_query.rb', line 79 def initialize(, request_id: nil, class_name: nil) @request_id = request_id @class_name = class_name text = .respond_to?(:message) ? . : .to_s prefix_parts = [] prefix_parts << "request_id=#{request_id}" if request_id prefix_parts << "class=#{class_name}" if class_name prefixed = prefix_parts.empty? ? text : "#{prefix_parts.join(' ')} #{text}" super(prefixed) end |
Instance Attribute Details
#class_name ⇒ String? (readonly)
Returns Parse class the subscription was targeting.
77 78 79 |
# File 'lib/parse/live_query.rb', line 77 def class_name @class_name end |
#request_id ⇒ Integer? (readonly)
Returns request id of the failed subscribe.
75 76 77 |
# File 'lib/parse/live_query.rb', line 75 def request_id @request_id end |