mirror of https://github.com/scrapy/scrapy.git
log errors importing or instanciating handlers
This commit is contained in:
parent
8c7997083f
commit
d3804b3439
|
|
@ -1,5 +1,6 @@
|
|||
"""Download handlers for different schemes"""
|
||||
|
||||
import logging
|
||||
from twisted.internet import defer
|
||||
import six
|
||||
from scrapy.exceptions import NotSupported, NotConfigured
|
||||
|
|
@ -8,6 +9,9 @@ from scrapy.utils.misc import load_object
|
|||
from scrapy import signals
|
||||
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class DownloadHandlers(object):
|
||||
|
||||
def __init__(self, crawler):
|
||||
|
|
@ -39,12 +43,16 @@ class DownloadHandlers(object):
|
|||
'no handler available for that scheme'
|
||||
return None
|
||||
|
||||
dhcls = load_object(self._schemes[scheme])
|
||||
try:
|
||||
dhcls = load_object(self._schemes[scheme])
|
||||
dh = dhcls(self._crawler_settings)
|
||||
except NotConfigured as ex:
|
||||
self._notconfigured[scheme] = str(ex)
|
||||
return None
|
||||
except Exception as ex:
|
||||
logger.exception()
|
||||
self._notconfigured[scheme] = str(ex)
|
||||
return None
|
||||
else:
|
||||
self._handlers[scheme] = dh
|
||||
return self._handlers[scheme]
|
||||
|
|
|
|||
Loading…
Reference in New Issue