Improve error handling for api.cursor
This commit is contained in:
parent
ede941cf1a
commit
c63ed8559e
1 changed files with 5 additions and 0 deletions
|
|
@ -470,6 +470,11 @@ class Twython(EndpointsMixin, object):
|
||||||
>>> print result
|
>>> print result
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
if not callable(function):
|
||||||
|
raise TypeError('.cursor() takes a Twython function as its first \
|
||||||
|
argument. Did you provide the result of a \
|
||||||
|
function call?')
|
||||||
|
|
||||||
if not hasattr(function, 'iter_mode'):
|
if not hasattr(function, 'iter_mode'):
|
||||||
raise TwythonError('Unable to create generator for Twython \
|
raise TwythonError('Unable to create generator for Twython \
|
||||||
method "%s"' % function.__name__)
|
method "%s"' % function.__name__)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue