Auxiliary::Web::HTTP: added error output

Instead of using elog when an HTTP request callback throws an
exception, use the HTTP class' parent #print_error.
bug/bundler_fix
Tasos Laskos 2013-03-07 20:14:38 +02:00
parent 1b8371e695
commit cf3df4b179
1 changed files with 9 additions and 2 deletions

View File

@ -67,6 +67,7 @@ class Auxiliary::Web::HTTP
attr_reader :opts
attr_reader :headers
attr_reader :framework
attr_reader :parent
attr_accessor :redirect_limit
attr_accessor :username , :password
@ -75,6 +76,7 @@ class Auxiliary::Web::HTTP
@opts = opts.dup
@framework = opts[:framework]
@parent = opts[:parent]
@headers = {
'Accept' => '*/*',
@ -130,8 +132,8 @@ class Auxiliary::Web::HTTP
begin
request.handle_response request( request.url, request.opts )
rescue => e
elog e.to_s
e.backtrace.each { |l| elog l }
print_error e.to_s
e.backtrace.each { |l| print_error l }
end
end
end
@ -250,6 +252,11 @@ class Auxiliary::Web::HTTP
private
def print_error( message )
return if !@parent
@parent.print_error message
end
def call_after_run_blocks
while block = @after_run_blocks.pop
block.call