Permalink
Browse files

Database.get: Handle possible connection errors better

This should be abstracted to a more common level, but for now this is
sufficient
  • Loading branch information...
nailor committed Jul 26, 2011
1 parent 695a315 commit 3c38cb1a1fdfd30eda8845e8c79c8c430cad5faf
Showing with 6 additions and 1 deletion.
  1. +6 −1 trombi/client.py
View
@@ -335,7 +335,12 @@ def set(self, *args, **kwargs):
def _really_callback(response):
try:
content = json.loads(response.body.decode('utf-8'))
# If the connection to the server is malfunctioning,
# ie. the simplehttpclient returns 599 and no body,
# don't set the content as the response.code will not
# be 201 at that point either
if response.body is not None:
content = json.loads(response.body.decode('utf-8'))
except ValueError:
content = response.body

0 comments on commit 3c38cb1

Please sign in to comment.