From ef8392e2670d5eeac535ba89267d4505dd23b1cb Mon Sep 17 00:00:00 2001 From: Roman Yepishev Date: Mon, 20 Feb 2012 23:45:07 +0200 Subject: [PATCH 1/2] Raise RuntimeError when gist is unavailable --- plugins/gist_tag.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugins/gist_tag.rb b/plugins/gist_tag.rb index 74dd3b3..f6ebbb3 100644 --- a/plugins/gist_tag.rb +++ b/plugins/gist_tag.rb @@ -82,6 +82,9 @@ module Jekyll https.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Get.new raw_uri.request_uri data = https.request request + if data.code != 200 + raise RuntimeError, "Gist replied with #{data.code} for #{gist_url}" + end data = data.body cache gist, file, data unless @cache_disabled data From 7ebc0a0d8b0cf276d5de4b51c823a4ee82710484 Mon Sep 17 00:00:00 2001 From: Roman Yepishev Date: Tue, 21 Feb 2012 11:07:45 +0200 Subject: [PATCH 2/2] Convert to integer before comparing. data.code is String --- plugins/gist_tag.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/gist_tag.rb b/plugins/gist_tag.rb index f6ebbb3..ee87fcf 100644 --- a/plugins/gist_tag.rb +++ b/plugins/gist_tag.rb @@ -82,7 +82,7 @@ module Jekyll https.verify_mode = OpenSSL::SSL::VERIFY_NONE request = Net::HTTP::Get.new raw_uri.request_uri data = https.request request - if data.code != 200 + if Integer(data.code) != 200 raise RuntimeError, "Gist replied with #{data.code} for #{gist_url}" end data = data.body