class Deepstream::ErrorHandler

Attributes

error[R]

Public Class Methods

new(client) click to toggle source
# File lib/deepstream/error_handler.rb, line 9
def initialize(client)
  @client = client
  @error = nil
end

Public Instance Methods

on_error(message) click to toggle source
# File lib/deepstream/error_handler.rb, line 14
def on_error(message)
  @error =
    if message.is_a?(Message)
      message.topic == TOPIC::ERROR ? message.data : Helpers.to_type(message.data.last)
    else
      message
    end
  puts "#{@error}\n" unless @client.options[:debug]
end
on_exception(exception) click to toggle source
# File lib/deepstream/error_handler.rb, line 24
def on_exception(exception)
  raise exception if @client.options[:debug]
  puts "\n#{exception.message}\n#{exception.backtrace}\n"
end