Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for 410 Gone HTTP response #2311

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/sphinx/exceptions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,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
Expand Down
2 changes: 2 additions & 0 deletions elasticsearch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
from .exceptions import ElasticsearchDeprecationWarning # noqa: F401
from .exceptions import (
ApiError,
ApiUnavailableException,
AuthenticationException,
AuthorizationException,
BadRequestError,
Expand All @@ -69,6 +70,7 @@

__all__ = [
"ApiError",
"ApiUnavailableException",
"AsyncElasticsearch",
"BadRequestError",
"Elasticsearch",
Expand Down
6 changes: 6 additions & 0 deletions elasticsearch/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"NotFoundError",
"ConflictError",
"BadRequestError",
"ApiUnavailableException",
]


Expand Down Expand Up @@ -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.
Expand All @@ -126,4 +131,5 @@ class ElasticsearchWarning(TransportWarning):
403: AuthorizationException,
404: NotFoundError,
409: ConflictError,
410: ApiUnavailableException,
}