From c7f66d7044cda5fac208063691a3e43a4166c3c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohnic=CC=81?= Date: Thu, 22 Nov 2012 13:06:05 +0100 Subject: [PATCH] don't reference SocketError before net/http is loaded Tries to fix #261 --- lib/hub/github_api.rb | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/lib/hub/github_api.rb b/lib/hub/github_api.rb index 8c4e1cc6..b9c18b52 100644 --- a/lib/hub/github_api.rb +++ b/lib/hub/github_api.rb @@ -173,11 +173,14 @@ module Hub apply_authentication(req, url) yield req if block_given? - res = http.start { http.request(req) } - res.extend ResponseMethods - res - rescue SocketError => err - raise Context::FatalError, "error with #{type.to_s.upcase} #{url} (#{err.message})" + + begin + res = http.start { http.request(req) } + res.extend ResponseMethods + return res + rescue SocketError => err + raise Context::FatalError, "error with #{type.to_s.upcase} #{url} (#{err.message})" + end end def request_uri url -- GitLab