def translate_es_errors(func):
"""Catches all Elasticsearch errors and raises an instance of SearchError."""
def wrapper(*a, **k):
try:
return func(*a, **k)
except exceptions.TransportError as e:
print(str(e))
raise SearchError("Elasticsearch refused connection: " + str(e))
return wrapper
评论列表
文章目录