Skip to content

Commit

Permalink
fix: Now display raw error instead of trying to parse it (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
qcoumes committed Mar 18, 2024
1 parent 9e908f2 commit 54c7af1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
13 changes: 3 additions & 10 deletions django_opensearch_dsl/management/commands/opensearch.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,17 +118,10 @@ def _manage_index(self, action, indices, force, verbosity, ignore_error, **optio
except opensearchpy.exceptions.NotFoundError:
pass
index.create()
except opensearchpy.exceptions.NotFoundError:
except opensearchpy.exceptions.TransportError as e:
if verbosity or not ignore_error:
self.stderr.write(f"{pp} index '{index._name}'...{self.style.ERROR('Error (not found)')}") # noqa
if not ignore_error:
self.stderr.write("exiting...")
exit(1)
except opensearchpy.exceptions.RequestError:
if verbosity or not ignore_error:
self.stderr.write(
f"{pp} index '{index._name}'... {self.style.ERROR('Error (already exists)')}"
) # noqa
error = self.style.ERROR(f"Error: {e.error} - {e.info}")
self.stderr.write(f"{pp} index '{index._name}'...\n{error}") # noqa
if not ignore_error:
self.stderr.write("exiting...")
exit(1)
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ version: '3.7'

services:

opensearch_test_1:
container_name: opensearch_test_1
opensearch_test_10:
container_name: opensearch_test_10
image: opensearchproject/opensearch:1
ports:
- "9210:9200"
Expand All @@ -13,8 +13,8 @@ services:
- discovery.type=single-node
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"

opensearch_test_2:
container_name: opensearch_test_2
opensearch_test_20:
container_name: opensearch_test_20
image: opensearchproject/opensearch:2
ports:
- "9220:9200"
Expand Down

0 comments on commit 54c7af1

Please sign in to comment.