Class: DripDrop::BaseHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/dripdrop/handlers/base.rb

Instance Method Summary collapse

Instance Method Details

#handle_error(exception, *extra) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dripdrop/handlers/base.rb', line 8

def handle_error(exception,*extra)
  if @err_cbak
    begin
      @err_cbak.call(exception,*extra)
    rescue StandardError => e
      print_exception(e)
    end
  else
    print_exception(e)
  end
end

#on_error(&block) ⇒ Object



4
5
6
# File 'lib/dripdrop/handlers/base.rb', line 4

def on_error(&block)
  @err_cbak = block
end


20
21
22
23
# File 'lib/dripdrop/handlers/base.rb', line 20

def print_exception(exception)
  $stderr.write exception.message
  $stderr.write exception.backtrace.join("\t\n")
end