]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
httputil: promote all Exceptions to RuntimeErrors so they can be caught with inline...
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 18 Sep 2007 11:05:01 +0000 (11:05 +0000)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Tue, 18 Sep 2007 11:05:01 +0000 (11:05 +0000)
lib/rbot/core/utils/httputil.rb

index 0bc579b162e7791043034339196544e602448311..00164616cfba7f2f068adbd84bd4988495c293b9 100644 (file)
@@ -502,6 +502,7 @@ class HttpUtil
     req.body = opts[:body] if req_class == Net::HTTP::Post
     debug "prepared request: #{req.to_hash.inspect}"
 
+    begin
     get_proxy(uri, opts).start do |http|
       http.request(req) do |resp|
         resp['x-rbot-location'] = uri.to_s
@@ -531,6 +532,10 @@ class HttpUtil
         return handle_response(uri, resp, opts, &block)
       end
     end
+    rescue Exception => e
+      error e
+      raise e.message
+    end
   end
 
   # _uri_::     uri to query (URI object or String)