From db265963689fd5780261f22d66644c06963799be Mon Sep 17 00:00:00 2001 From: Fantix King Date: Fri, 24 Jun 2022 14:29:55 -0400 Subject: [PATCH] Drop COMMAND_COMPLETE_WITH_CONSEQUENCE_MSG and sync errors --- edgedb/errors/__init__.py | 25 ++++++++++--------------- edgedb/protocol/consts.pxi | 1 - edgedb/protocol/protocol.pyx | 26 -------------------------- 3 files changed, 10 insertions(+), 42 deletions(-) diff --git a/edgedb/errors/__init__.py b/edgedb/errors/__init__.py index 243df77e..87117443 100644 --- a/edgedb/errors/__init__.py +++ b/edgedb/errors/__init__.py @@ -22,13 +22,12 @@ 'TypeSpecNotFoundError', 'UnexpectedMessageError', 'InputDataError', + 'ParameterTypeMismatchError', + 'StateMismatchError', 'ResultCardinalityMismatchError', 'CapabilityError', 'UnsupportedCapabilityError', 'DisabledCapabilityError', - 'StateError', - 'StateSerializationError', - 'StateMismatchError', 'QueryError', 'InvalidSyntaxError', 'EdgeQLSyntaxError', @@ -144,6 +143,14 @@ class InputDataError(ProtocolError): _code = 0x_03_02_00_00 +class ParameterTypeMismatchError(InputDataError): + _code = 0x_03_02_01_00 + + +class StateMismatchError(InputDataError): + _code = 0x_03_02_02_00 + + class ResultCardinalityMismatchError(ProtocolError): _code = 0x_03_03_00_00 @@ -160,18 +167,6 @@ class DisabledCapabilityError(CapabilityError): _code = 0x_03_04_02_00 -class StateError(ProtocolError): - _code = 0x_03_05_00_00 - - -class StateSerializationError(StateError): - _code = 0x_03_05_00_01 - - -class StateMismatchError(StateError): - _code = 0x_03_05_00_02 - - class QueryError(EdgeDBError): _code = 0x_04_00_00_00 diff --git a/edgedb/protocol/consts.pxi b/edgedb/protocol/consts.pxi index f158203e..96130e0f 100644 --- a/edgedb/protocol/consts.pxi +++ b/edgedb/protocol/consts.pxi @@ -27,7 +27,6 @@ DEF READY_FOR_COMMAND_MSG = b'Z' DEF SYNC_MSG = b'S' DEF FLUSH_MSG = b'H' DEF COMMAND_COMPLETE_MSG = b'C' -DEF COMMAND_COMPLETE_WITH_CONSEQUENCE_MSG = b'c' DEF DATA_MSG = b'D' DEF COMMAND_DATA_DESC_MSG = b'T' DEF LOG_MSG = b'L' diff --git a/edgedb/protocol/protocol.pyx b/edgedb/protocol/protocol.pyx index 4d189df0..052a7a23 100644 --- a/edgedb/protocol/protocol.pyx +++ b/edgedb/protocol/protocol.pyx @@ -341,11 +341,6 @@ cdef class SansIOProtocol: elif mtype == COMMAND_COMPLETE_MSG: self.parse_command_complete_message() - elif mtype == COMMAND_COMPLETE_WITH_CONSEQUENCE_MSG: - ex = self.parse_command_complete_with_conseq_message() - if not isinstance(ex, errors.StateSerializationError): - exc = ex - elif mtype == ERROR_RESPONSE_MSG: exc = self.parse_error_message() exc = self._amend_parse_error( @@ -1095,27 +1090,6 @@ cdef class SansIOProtocol: self.buffer.read_len_prefixed_bytes() # state self.buffer.finish_message() - cdef parse_command_complete_with_conseq_message(self): - assert ( - self.buffer.get_message_type() == - COMMAND_COMPLETE_WITH_CONSEQUENCE_MSG - ) - self.ignore_headers() - self.last_capabilities = enums.Capability(self.buffer.read_int64()) - self.last_status = self.buffer.read_len_prefixed_bytes() - - code = self.buffer.read_int32() - msg = self.buffer.read_len_prefixed_utf8() - attrs = self.parse_error_headers() - self.buffer.finish_message() - - # It's safe to always map error codes as we don't reuse them - code = OLD_ERROR_CODES.get(code, code) - - exc = errors.EdgeDBError._from_code(code, msg) - exc._attrs = attrs - return exc - cdef parse_sync_message(self): cdef char status