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

Fixed handling of DuplicateKeyException errors after crate-python 0.34 #439

Merged
merged 1 commit into from
Apr 24, 2024
Merged
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
5 changes: 5 additions & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ Changes for crash
Unreleased
==========

- Fixed handling of ``DuplicateKeyException`` errors. After an improvement in
crate-python 0.34, this error case is conveyed through ``IntegrityError``.
Beforehand, a more generic ``ProgrammingError`` was used. Thanks, @romseygeek
and @proddata.

2024/03/19 0.31.4
=================

Expand Down
4 changes: 2 additions & 2 deletions crate/crash/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from verlib2 import Version

from crate.client import connect
from crate.client.exceptions import ConnectionError, ProgrammingError
from crate.client.exceptions import ConnectionError, IntegrityError, ProgrammingError

from ..crash import __version__ as crash_version
from .commands import Command, built_in_commands
Expand Down Expand Up @@ -452,7 +452,7 @@ def _exec(self, statement: str) -> bool:
self.logger.warn(str(e))
self.logger.warn(
'Use \\connect <server> to connect to one or more servers first.')
except ProgrammingError as e:
except (ProgrammingError, IntegrityError) as e:
self.logger.critical(e.message)
if self.error_trace and e.error_trace:
self.logger.critical('\n' + e.error_trace)
Expand Down