@@ -32,7 +32,7 @@ class TransportError(ElasticsearchException):
|
|||||||
return self.args[2]
|
return self.args[2]
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'TransportError(%d, %r)' % (self.status_code, self.error)
|
return 'TransportError(%s, %r)' % (self.status_code, self.error)
|
||||||
|
|
||||||
|
|
||||||
class ConnectionError(TransportError):
|
class ConnectionError(TransportError):
|
||||||
|
|||||||
@@ -175,7 +175,7 @@ class Transport(object):
|
|||||||
except (ConnectionError, SerializationError):
|
except (ConnectionError, SerializationError):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
raise TransportError("Enable to sniff hosts.")
|
raise TransportError("N/A", "Enable to sniff hosts.")
|
||||||
except:
|
except:
|
||||||
# keep the previous value on error
|
# keep the previous value on error
|
||||||
self.last_sniff = previous_sniff
|
self.last_sniff = previous_sniff
|
||||||
@@ -198,7 +198,7 @@ class Transport(object):
|
|||||||
# we weren't able to get any nodes, maybe using an incompatible
|
# we weren't able to get any nodes, maybe using an incompatible
|
||||||
# transport_schema or host_info_callback blocked all - raise error.
|
# transport_schema or host_info_callback blocked all - raise error.
|
||||||
if not hosts:
|
if not hosts:
|
||||||
raise TransportError("Enable to sniff hosts - no viable hosts found.")
|
raise TransportError("N/A", "Enable to sniff hosts - no viable hosts found.")
|
||||||
|
|
||||||
self.set_connections(hosts)
|
self.set_connections(hosts)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user