diff options
author | Victor Häggqvist <[email protected]> | 2014-05-09 00:42:49 +0200 |
---|---|---|
committer | Victor Häggqvist <[email protected]> | 2014-05-09 00:42:49 +0200 |
commit | 1aa2c29b86b1a3c9ce95e3c33f2f0f88f8dcd533 (patch) | |
tree | f8d9bb3120f406fac8c7d2c3d6e3293001a25bbf /giti.py | |
parent | 56dded948eb2100fb9d6bafde9689916af057e32 (diff) |
some what improved exception handling
Diffstat (limited to '')
-rwxr-xr-x | giti.py | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -5,7 +5,7 @@ import sys import urllib2 __author__ = 'Victor Häggqvist' -__version__ = 0.1 +__version__ = '0.1.1' def gitiglobal(type): @@ -16,8 +16,13 @@ def gitiglobal(type): try: gifile = urllib2.urlopen("https://raw.githubusercontent.com/github/gitignore/master/Global/"+type+".gitignore").read() store(gifile) - except: - print "Not found in global either" + except urllib2.HTTPError as e: + if e.code == 404: + print "Not found in global either" + else: + print "Got unexpected answer from Github, you better check on them..." + + def store(file): @@ -54,9 +59,14 @@ def giti(type): try: gifile = urllib2.urlopen("https://raw.githubusercontent.com/github/gitignore/master/"+type+".gitignore").read() store(gifile) - except: - print "not found in master" - gitiglobal(type) + except urllib2.HTTPError as e: + if e.code == 404: + print "Not found in master" + gitiglobal(type) + else: + print "Got unexpected answer from Github, you better check on them..." + + def main(): |