Skip to content

Commit

Permalink
fix: Replace RequestError with BadRequestError (#3172)
Browse files Browse the repository at this point in the history
* fix: Replace RequestError with BadRequestError

* Lint

---------

Co-authored-by: Olga Bulat <[email protected]>
  • Loading branch information
CodeAnk2829 and obulat authored Oct 10, 2023
1 parent 1487f91 commit 8e447ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions api/api/controllers/search_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from django.conf import settings
from django.core.cache import cache

from elasticsearch.exceptions import NotFoundError, RequestError
from elasticsearch.exceptions import BadRequestError, NotFoundError
from elasticsearch_dsl import Q, Search
from elasticsearch_dsl.query import EMPTY_QUERY, MoreLikeThis, Query
from elasticsearch_dsl.response import Hit, Response
Expand Down Expand Up @@ -447,7 +447,7 @@ def search(

if settings.VERBOSE_ES_RESPONSE:
log.info(pprint.pprint(search_response.to_dict()))
except (RequestError, NotFoundError) as e:
except (BadRequestError, NotFoundError) as e:
raise ValueError(e)

results = _post_process_results(
Expand Down
4 changes: 2 additions & 2 deletions documentation/meta/monitoring/cloudwatch_logs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ outputs stack traces, for example, this means that stack traces will be split
across multiple lines. Take the following, real stack trace:

```
2023-06-04T00:32:12.485Z 2023-06-04 00:32:12,485 ERROR tasks.py:220 - Error processing task `CREATE_AND_POPULATE_FILTERED_INDEX` for `audio`: RequestError(400, 'search_phase_execution_exception', 'too_many_clauses: maxClauseCount is set to 1024')
2023-06-04T00:32:12.485Z 2023-06-04 00:32:12,485 ERROR tasks.py:220 - Error processing task `CREATE_AND_POPULATE_FILTERED_INDEX` for `audio`: BadRequestError(400, 'search_phase_execution_exception', 'too_many_clauses: maxClauseCount is set to 1024')
2023-06-04T00:32:12.539Z Process Process-5:
2023-06-04T00:32:12.541Z Traceback (most recent call last):
2023-06-04T00:32:12.541Z File "/usr/local/lib/python3.11/multiprocessing/process.py", line 314, in _bootstrap
Expand All @@ -211,7 +211,7 @@ across multiple lines. Take the following, real stack trace:
2023-06-04T00:32:12.541Z self._raise_error(response.status_code, raw_data)
2023-06-04T00:32:12.541Z File "/venv/lib/python3.11/site-packages/elasticsearch/connection/base.py", line 328, in _raise_error
2023-06-04T00:32:12.541Z raise HTTP_EXCEPTIONS.get(status_code, TransportError)(
2023-06-04T00:32:12.541Z elasticsearch.exceptions.RequestError: RequestError(400, 'search_phase_execution_exception', 'too_many_clauses: maxClauseCount is set to 1024')
2023-06-04T00:32:12.541Z elasticsearch.exceptions.BadRequestError: BadRequestError(400, 'search_phase_execution_exception', 'too_many_clauses: maxClauseCount is set to 1024')
```

Each line (prepended with a timestamp), is a separate log event. The implication
Expand Down

0 comments on commit 8e447ed

Please sign in to comment.