From: Marcin Koziej Date: Fri, 14 Sep 2012 12:08:22 +0000 (+0200) Subject: more informative erro message [error connecting to Solr] X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/6e5871ce487810fa5dac891e03296c6d469ffeb3?ds=inline;hp=-c more informative erro message [error connecting to Solr] --- 6e5871ce487810fa5dac891e03296c6d469ffeb3 diff --git a/apps/search/custom.py b/apps/search/custom.py index 788b6c409..86d387e02 100644 --- a/apps/search/custom.py +++ b/apps/search/custom.py @@ -5,7 +5,7 @@ import urllib import warnings from sunburnt import search import copy - +from httplib2 import socket class TermVectorOptions(search.Options): def __init__(self, schema, original=None): @@ -89,7 +89,11 @@ class CustomSolrInterface(sunburnt.SolrInterface): self.writeable = False elif 'r' not in mode: self.readable = False - self.init_schema() + try: + self.init_schema() + except socket.error, e: + raise socket.error, "Cannot connect to Solr server, and search indexing is enabled (%s)" % str(e) + def _analyze(self, **kwargs): if not self.readable: