On 02:04 pm, bra@fsn.hu wrote:
Hi,
On 06/03/11 15:57, exarkun@twistedmatrix.com wrote:
As you can see, the connection is timed out, and protocols/memcached.py lost its connection. But how could I catch this around the "mc.get" call? I guess this error should raise an exception, so enclosing mc.get into a try-except would make possible to catch this. But currently this is not the case?
What do you think it is not the case? That is how inlineCallbacks makes Failures available to you.
Because if I wrap mc.get into a try-except clause, it's not triggered. I guess if it would, the above error would show exact line numbers too.
I can't reproduce this. I changed the code to: @defer.inlineCallbacks def query(): try: res = yield mc.get('test') except Exception, e: print "get failed:", e else: print "XXX",res When I run this against the nc server, the "get failed:" print happens. Jean-Paul