def parsed_response(body)
      [JSON.parse(body), '']
    rescue JSON::ParserError
      ['', body.match(/message='([^']+)'/).captures.first]
    end
def parsed_response(body)
      [JSON.parse(body), '']
    rescue JSON::ParserError
      ['', body.match(/message='([^']+)'/).captures.first]
    end
A bad query doesn't send back a JSON object. It sends back a
 string with an embedded message.