mirror of https://github.com/scrapy/scrapy.git
Improve error message when callback is not callable
This commit is contained in:
parent
4b6f68b9ee
commit
bb0bd691d9
|
|
@ -28,9 +28,9 @@ class Request(object_ref):
|
|||
self.priority = priority
|
||||
|
||||
if callback is not None and not callable(callback):
|
||||
raise TypeError('callback must be a function, got %s' % type(callback).__name__)
|
||||
raise TypeError('callback must be a callable, got %s' % type(callback).__name__)
|
||||
if errback is not None and not callable(errback):
|
||||
raise TypeError('errback must be a function, got %s' % type(errback).__name__)
|
||||
raise TypeError('errback must be a callable, got %s' % type(errback).__name__)
|
||||
assert callback or not errback, "Cannot use errback without a callback"
|
||||
self.callback = callback
|
||||
self.errback = errback
|
||||
|
|
|
|||
Loading…
Reference in New Issue