Commands with kwargs fail with TypeError instead of ConnectionError when connection is down #46

merged 1 commit into from Mar 30, 2013


None yet
2 participants

a-kr commented Mar 30, 2013

When the connection to Redis server is down, ConnectionHandler replaces proper methods with dummy lambdas which accept only positional arguments. If some Redis command is then called with keyword arguments, a confusing traceback is produced:

2013-03-30 23:33:05+0400 [HTTPChannel,1,] Unhandled Error
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/twisted/protocols/", line 581, in dataReceived
    why = self.lineReceived(line)
  File "/usr/local/lib/python2.7/dist-packages/twisted/web/", line 1611, in lineReceived
  File "/usr/local/lib/python2.7/dist-packages/twisted/web/", line 1686, in allContentReceived
    req.requestReceived(command, path, version)
  File "/usr/local/lib/python2.7/dist-packages/twisted/web/", line 790, in requestReceived
--- <exception caught here> ---
  File "/usr/local/lib/python2.7/dist-packages/twisted/web/", line 192, in process
  File "/usr/local/lib/python2.7/dist-packages/twisted/web/", line 241, in render
    body = resrc.render(self)
  File "/usr/local/lib/python2.7/dist-packages/twisted/web/", line 250, in render
    return m(request)
  File "", line 59, in render_GET
    self.db.zrangebyscore('foo', count=33, offset=0)
exceptions.TypeError: <lambda>() got an unexpected keyword argument 'count'

Attached patch allows this dummy lambda to accept keyword arguments, so that a proper error message can be seen in server log:

2013-03-30 23:32:08+0400 [HTTPChannel,1,] Unhandled Error
Traceback (most recent call last):
Failure: txredisapi.ConnectionError: Not connected

fiorix merged commit 0c62064 into fiorix:master Mar 30, 2013

1 check passed

default The Travis build passed

fiorix commented Mar 30, 2013

Good catch, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment