From: Magnus Hagander Date: Wed, 7 Oct 2009 11:41:14 +0000 (+0200) Subject: Fix exception handling X-Git-Url: http://git.postgresql.org/gitweb/static/session/%7B%7Bsession.id%7D%7D-%7B%7Bsession.title%7Cslugify%7D%7D?a=commitdiff_plain;h=3407ccd7441ffcaf5066b627a8e9757e8aec0498;p=hamn.git Fix exception handling --- diff --git a/posttotwitter.py b/posttotwitter.py index c02fd8e..5086238 100755 --- a/posttotwitter.py +++ b/posttotwitter.py @@ -83,7 +83,7 @@ class PostToTwitter: try: status = self.twitter.PostUpdate(msg) except Exception, e: - print "Error posting to twitter: %s" % e + print "Error posting to twitter (post %s): %s" % (post[0], e) # We'll just try again with the next one continue @@ -115,7 +115,7 @@ class PostToTwitter: ret=instream.read() instream.close() except Exception, e: - raise "Failed in call to tr.im API: %s" % e + raise Exception("Failed in call to tr.im API: %s" % e) if len(ret)==0: raise "tr.im returned blank!" @@ -124,7 +124,7 @@ class PostToTwitter: trim = json.loads(ret) return trim['url'] except Exception, e: - raise "Failed to JSON parse tr.im response: %s" % e + raise Exception("Failed to JSON parse tr.im response: %s" % e) if __name__=="__main__":