Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Commit

Permalink
Improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
Mincka committed Dec 30, 2017
1 parent 1577327 commit 0af930d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dmarchiver/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import time
import lxml.html
import requests
import traceback

__all__ = ['Crawler']

Expand Down Expand Up @@ -654,9 +655,10 @@ def _process_tweets(self, tweets, download_images, download_gifs, download_video
'Script execution interruption requested. Writing the conversation.')
self._max_id_found = True
break
except:
except Exception as ex:
print(
'Unexpected error for tweet \'{0}\', raw HTML will be used for the tweet.'.format(tweet_id))
'Unexpected error \'{0}\' for tweet \'{1}\', raw HTML will be used for the tweet.'.format(ex, tweet_id))
traceback.print_exc()
message = DMConversationEntry(
tweet_id, '[ParseError] Parsing of tweet \'{0}\' failed. Raw HTML: {1}'.format(
tweet_id, value))
Expand Down

0 comments on commit 0af930d

Please sign in to comment.