Improve error handling
This commit is contained in:
parent
9bff3399a8
commit
61632c7143
|
@ -4,6 +4,7 @@ import sys
|
||||||
import urllib.request
|
import urllib.request
|
||||||
from html.parser import HTMLParser
|
from html.parser import HTMLParser
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
from urllib.error import HTTPError
|
||||||
|
|
||||||
import imgurpython
|
import imgurpython
|
||||||
from multiprocessing import Queue
|
from multiprocessing import Queue
|
||||||
|
@ -72,15 +73,10 @@ def getFile(fileDir,tempDir,imageURL,indent=0):
|
||||||
|
|
||||||
class Erome:
|
class Erome:
|
||||||
def __init__(self,directory,post):
|
def __init__(self,directory,post):
|
||||||
# try:
|
try:
|
||||||
# IMAGES = self.getLinks(post['postURL'])
|
IMAGES = self.getLinks(post['postURL'])
|
||||||
# except IndexError:
|
except urllib.error.HTTPError:
|
||||||
# # raise NotADownloadableLinkError("Could not read the page source")
|
raise NotADownloadableLinkError("Not a downloadable link")
|
||||||
# pass
|
|
||||||
# except Exception as exception:
|
|
||||||
# pass
|
|
||||||
# # raise NotADownloadableLinkError("Could not read the page source")
|
|
||||||
IMAGES = self.getLinks(post['postURL'])
|
|
||||||
|
|
||||||
imagesLenght = len(IMAGES)
|
imagesLenght = len(IMAGES)
|
||||||
howManyDownloaded = imagesLenght
|
howManyDownloaded = imagesLenght
|
||||||
|
|
Loading…
Reference in a new issue