Terrible, horrible exception handling. Terrible. Seriously. Can't be bothered to improve it.

This commit is contained in:
Klaus-Uwe Mitterer 2015-03-19 19:38:33 +01:00
parent a5fc8d5d6b
commit 4baabc3017
2 changed files with 8 additions and 2 deletions

View file

@ -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

View file

@ -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)