From 1dbe7f6f3da701497718fde046fe0e0e0818358c Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Fri, 12 Feb 2016 02:18:17 -0800 Subject: [PATCH] handle errors better here --- src/twtxt.nim | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/twtxt.nim b/src/twtxt.nim index a9a78dc..b4951af 100644 --- a/src/twtxt.nim +++ b/src/twtxt.nim @@ -54,7 +54,9 @@ proc getTweetsFrom*(url: string, username: string): seq[Tweet] = for line in body.splitLines().items(): if line.len > 0 and line[0] != '#': - res.add(username.parseTweet(line)) + try: + res.add(username.parseTweet(line)) + except: echo username & " " & getCurrentExceptionMsg() return res @@ -68,4 +70,4 @@ proc updateTweetsByUser*(db: DBConn, username, url: string) {. gcsafe .} = db.exec(sql"insert into tweets values(null, ?, ?, ?);", username, tweet.date.timeInfoToTime().toSeconds().int(), tweet.message) except: discard except: - echo getCurrentExceptionMsg() + echo username & " " & getCurrentExceptionMsg()