Improve error message when callback is not callable

This commit is contained in:
Valdir Stumm Junior 2017-07-24 11:12:09 -03:00
parent 4b6f68b9ee
commit bb0bd691d9
1 changed files with 2 additions and 2 deletions

View File

@ -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