Skip to content

Commit

Permalink
Improve error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
aliparlakci committed Jul 23, 2018
1 parent 9bff339 commit 61632c7
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import urllib.request
from html.parser import HTMLParser
from pathlib import Path
from urllib.error import HTTPError

import imgurpython
from multiprocessing import Queue
Expand Down Expand Up @@ -72,15 +73,10 @@ def getFile(fileDir,tempDir,imageURL,indent=0):

class Erome:
def __init__(self,directory,post):
# try:
# IMAGES = self.getLinks(post['postURL'])
# except IndexError:
# # raise NotADownloadableLinkError("Could not read the page source")
# pass
# except Exception as exception:
# pass
# # raise NotADownloadableLinkError("Could not read the page source")
IMAGES = self.getLinks(post['postURL'])
try:
IMAGES = self.getLinks(post['postURL'])
except urllib.error.HTTPError:
raise NotADownloadableLinkError("Not a downloadable link")

imagesLenght = len(IMAGES)
howManyDownloaded = imagesLenght
Expand Down

0 comments on commit 61632c7

Please sign in to comment.