Class: Termtter::UserStreamReceiver

Inherits:
Object
  • Object
show all
Defined in:
lib/plugins/user_stream.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.repack_error(error, chunk) ⇒ Object



15
16
17
18
19
20
21
22
23
# File 'lib/plugins/user_stream.rb', line 15

def self.repack_error(error, chunk)
  new_error = error.class.new("#{error.message} (#{JSON.parse(chunk).inspect})")
  error.instance_variables.each{ |v|
    new_error.instance_variable_set(v, error.instance_variable_get(v))
  }
  new_error
rescue
  error
end

Instance Method Details

#run(&block) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/plugins/user_stream.rb', line 4

def run(&block)
  loop {
    begin
      self.process &block
    rescue => error
      Termtter::Client.handle_error error
      sleep 10
    end
  }
end