Class: DripDrop::BaseHandler
- Inherits:
-
Object
- Object
- DripDrop::BaseHandler
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,*)
if @err_cbak
begin
@err_cbak.call(exception,*)
rescue StandardError => e
print_exception(e)
end
else
print_exception(exception)
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
|
#print_exception(exception) ⇒ Object
20
21
22
23
24
25
26
27
|
# File 'lib/dripdrop/handlers/base.rb', line 20
def print_exception(exception)
if exception.is_a?(Exception)
$stderr.write exception.message
$stderr.write exception.backtrace.join("\t\n")
else
$stderr.write "Expected an exception, got: #{exception.inspect}"
end
end
|