From 4baabc3017e3d6e3b9e976fc59cef880c9a870dc Mon Sep 17 00:00:00 2001 From: Klaus-Uwe Mitterer Date: Thu, 19 Mar 2015 19:38:33 +0100 Subject: [PATCH] Terrible, horrible exception handling. Terrible. Seriously. Can't be bothered to improve it. --- getter.py | 6 +++++- tweeter.py | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/getter.py b/getter.py index 0557e5d..fd13b94 100755 --- a/getter.py +++ b/getter.py @@ -40,11 +40,14 @@ while True: cur.execute("DELETE FROM tweets WHERE sender = %s;" % sender) sql_conn.commit() continue - except: + except Exception, e: + print "Error in " + str(twid) + print e continue try: date = dateutil.parser.parse(text,dayfirst=True,fuzzy=True) except ValueError, e: + print "Error in " + str(twid) print e try: api.update_status("@%s Sorry, ich verstehe deinen Tweet nicht... :(" % sender, twid) @@ -62,6 +65,7 @@ while True: try: api.update_status("@%s Das war doch schon...?" % sender, twid) except Exception, e: + print "Error in " + str(twid) print e continue diff --git a/tweeter.py b/tweeter.py index 9b4b23d..479f16b 100755 --- a/tweeter.py +++ b/tweeter.py @@ -40,7 +40,9 @@ while True: api.update_status("@%s %s" % (recipient, text), original) cur.execute("UPDATE tweets SET sent = 1 WHERE tweet_id = %i" % original) sql_conn.commit() - except: + except Exception, e: + print "Error in " + str(twid) + print e pass time.sleep(10)