inoi / trombi

Trombi is an asynchronous CouchDB client for Tornado

Home Page:http://inoi.github.com/trombi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Database.get() fails ungracefully in some situations

akheron opened this issue · comments

I'm seeing tracebacks like this in my application:
...
File "/usr/lib/pymodules/python2.6/trombi/client.py", line 298, in _really_callback
data = json.loads(response.body)
File "/usr/lib/python2.6/json/init.py", line 307, in loads
return _default_decoder.decode(s)
File "/usr/lib/python2.6/json/decoder.py", line 319, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
TypeError: expected string or buffer

I don't know exactly what CouchDB responds, but the response doesn't contain valid JSON anyhow. It could be that CouchDB cannot be connected to an curl is returning 599.

Anyway, Trombi should handle this situation and return its own error object in this case and not just crash.

Database: Decode JSON only when response for get is a success

Closed by c92df4a.