diff --git a/docs/sphinx/exceptions.rst b/docs/sphinx/exceptions.rst index e766cfeab..49ae7f7c0 100644 --- a/docs/sphinx/exceptions.rst +++ b/docs/sphinx/exceptions.rst @@ -18,6 +18,7 @@ These errors are triggered from an HTTP response that isn't 2XX: .. autoclass:: RequestError .. autoclass:: AuthenticationException .. autoclass:: AuthorizationException +.. autoclass:: ApiUnavailableException .. autoclass:: UnsupportedProductError Transport and Connection Errors diff --git a/elasticsearch/__init__.py b/elasticsearch/__init__.py index 723b3a2b7..a33fbb515 100644 --- a/elasticsearch/__init__.py +++ b/elasticsearch/__init__.py @@ -47,6 +47,7 @@ from .exceptions import ElasticsearchDeprecationWarning # noqa: F401 from .exceptions import ( ApiError, + ApiUnavailableException, AuthenticationException, AuthorizationException, BadRequestError, @@ -74,6 +75,7 @@ __all__ = [ "ApiError", + "ApiUnavailableException", "AsyncElasticsearch", "BadRequestError", "Elasticsearch", diff --git a/elasticsearch/exceptions.py b/elasticsearch/exceptions.py index dc410ae30..73d11d132 100644 --- a/elasticsearch/exceptions.py +++ b/elasticsearch/exceptions.py @@ -36,6 +36,7 @@ "NotFoundError", "ConflictError", "BadRequestError", + "ApiUnavailableException", ] @@ -109,6 +110,10 @@ class AuthorizationException(ApiError): """Exception representing a 403 status code.""" +class ApiUnavailableException(ApiError): + """Exception representing a 410 status code.""" + + class ElasticsearchWarning(TransportWarning): """Warning that is raised when a deprecated option or incorrect usage is flagged via the 'Warning' HTTP header. @@ -130,4 +135,5 @@ class GeneralAvailabilityWarning(TransportWarning): 403: AuthorizationException, 404: NotFoundError, 409: ConflictError, + 410: ApiUnavailableException, }