toastdriven/pysolr — pull request #117 by marcelchastain (2014-05-04 02:17:24+00:00)
Title: check for/handle additional tomcat error responses

Fixes #92: "AttributeError: 'NoneType' object has no attribute 'cssselect'"

Based on @MaximusV's comment here:
https://github.com/toastdriven/pysolr/pull/92/files#r7033808

Test for body_node before continuing to try to traverse html.
If reason isn't set by the end of the block, try to extract reason from possible json response that looks like this:

```json
'{"responseHeader":{"status":400,"QTime":0,"params":{"fl":"* score","sort":"recipient asc","start":"0","q":"(showroom_id:(5) AND user_id:(5))","wt":"json","fq":"django_ct:(sharer.emailshare)","rows":"25"}},"error":{"msg":"sort param field can\'t be found: recipient","code":400}}\n'
```