summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorryanss2015-02-08 14:48:52 -0500
committerryanss2015-02-08 14:48:52 -0500
commit7c9b0f0ae71af7bf11553bde4c09e5a0df728df6 (patch)
tree94c079ee6691bdb1a33e8a17f063e0e3ed3a3d3d
parentb31159d5511f0444f15b23ce7b350825cb1ee876 (diff)
downloadvim-hn-7c9b0f0ae71af7bf11553bde4c09e5a0df728df6.tar.gz
Improve HTTP Error information
-rw-r--r--plugin/hackernews.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/plugin/hackernews.py b/plugin/hackernews.py
index bcebee0..9f6f4ba 100644
--- a/plugin/hackernews.py
+++ b/plugin/hackernews.py
@@ -58,6 +58,9 @@ def hacker_news():
try:
news1 = json.loads(urllib2.urlopen(API_URL+"/news", timeout=5).read())
news2 = json.loads(urllib2.urlopen(API_URL+"/news2", timeout=5).read())
+ except urllib2.HTTPError, e:
+ print "HackerNews.vim Error: %s" % str(e)
+ return
except:
print "HackerNews.vim Error: HTTP Request Timeout"
return
@@ -100,6 +103,9 @@ def hacker_news_link(external=False):
try:
item = json.loads(urllib2.urlopen(API_URL+"/item/"+id,
timeout=5).read())
+ except urllib2.HTTPError, e:
+ print "HackerNews.vim Error: %s" % str(e)
+ return
except:
print "HackerNews.vim Error: HTTP Request Timeout"
return
@@ -167,6 +173,9 @@ def hacker_news_link(external=False):
return
try:
content = urllib2.urlopen(MARKDOWN_URL+url, timeout=5).read()
+ except urllib2.HTTPError, e:
+ print "HackerNews.vim Error: %s" % str(e)
+ return
except:
print "HackerNews.vim Error: HTTP Request Timeout"
return