Skip to content

Commit b83163b

Browse files
committed
Add support for 410 Gone
1 parent 5520fd4 commit b83163b

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

docs/sphinx/exceptions.rst

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ These errors are triggered from an HTTP response that isn't 2XX:
1717
.. autoclass:: RequestError
1818
.. autoclass:: AuthenticationException
1919
.. autoclass:: AuthorizationException
20+
.. autoclass:: ApiUnavailableException
2021
.. autoclass:: UnsupportedProductError
2122

2223
Transport and Connection Errors

elasticsearch/__init__.py

+2
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
from .exceptions import ElasticsearchDeprecationWarning # noqa: F401
4848
from .exceptions import (
4949
ApiError,
50+
ApiUnavailableException,
5051
AuthenticationException,
5152
AuthorizationException,
5253
BadRequestError,
@@ -69,6 +70,7 @@
6970

7071
__all__ = [
7172
"ApiError",
73+
"ApiUnavailableException",
7274
"AsyncElasticsearch",
7375
"BadRequestError",
7476
"Elasticsearch",

elasticsearch/exceptions.py

+6
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"NotFoundError",
3737
"ConflictError",
3838
"BadRequestError",
39+
"ApiUnavailableException",
3940
]
4041

4142

@@ -109,6 +110,10 @@ class AuthorizationException(ApiError):
109110
"""Exception representing a 403 status code."""
110111

111112

113+
class ApiUnavailableException(ApiError):
114+
"""Exception representing a 410 status code."""
115+
116+
112117
class ElasticsearchWarning(TransportWarning):
113118
"""Warning that is raised when a deprecated option
114119
or incorrect usage is flagged via the 'Warning' HTTP header.
@@ -126,4 +131,5 @@ class ElasticsearchWarning(TransportWarning):
126131
403: AuthorizationException,
127132
404: NotFoundError,
128133
409: ConflictError,
134+
410: ApiUnavailableException,
129135
}

0 commit comments

Comments
 (0)