Skip to content

Commit

Permalink
Merge pull request #32 from rachmadaniHaryono/catch-exception-support
Browse files Browse the repository at this point in the history
fix issues #13 : add try catch exception
  • Loading branch information
HoverHell committed Oct 2, 2015
2 parents 92a3705 + db6495d commit 37f2f76
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions redditdownload.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,12 +336,16 @@ def extract_urls(url):
print ' Attempting to download URL [%s] as [%s].' % (URL.encode('utf-8'), FILENAME.encode('utf-8'))

# Download the image
download_from_url(URL, FILEPATH)

# Image downloaded successfully!
print ' Sucessfully downloaded URL [%s] as [%s].' % (URL, FILENAME)
DOWNLOADED += 1
FILECOUNT += 1
try:
download_from_url(URL, FILEPATH)
# Image downloaded successfully!
print ' Sucessfully downloaded URL [%s] as [%s].' % (URL, FILENAME)
DOWNLOADED += 1
FILECOUNT += 1

except Exception,e:
print ' %s' % str(e)
ERRORS += 1

if ARGS.num > 0 and DOWNLOADED >= ARGS.num:
FINISHED = True
Expand Down

0 comments on commit 37f2f76

Please sign in to comment.