handle errors better here
This commit is contained in:
parent
2e5c37a97c
commit
1dbe7f6f3d
|
@ -54,7 +54,9 @@ proc getTweetsFrom*(url: string, username: string): seq[Tweet] =
|
||||||
|
|
||||||
for line in body.splitLines().items():
|
for line in body.splitLines().items():
|
||||||
if line.len > 0 and line[0] != '#':
|
if line.len > 0 and line[0] != '#':
|
||||||
res.add(username.parseTweet(line))
|
try:
|
||||||
|
res.add(username.parseTweet(line))
|
||||||
|
except: echo username & " " & getCurrentExceptionMsg()
|
||||||
|
|
||||||
return res
|
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)
|
db.exec(sql"insert into tweets values(null, ?, ?, ?);", username, tweet.date.timeInfoToTime().toSeconds().int(), tweet.message)
|
||||||
except: discard
|
except: discard
|
||||||
except:
|
except:
|
||||||
echo getCurrentExceptionMsg()
|
echo username & " " & getCurrentExceptionMsg()
|
||||||
|
|
Loading…
Reference in New Issue