Skip to content

Commit

Permalink
Drop COMMAND_COMPLETE_WITH_CONSEQUENCE_MSG and sync errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fantix committed Jun 24, 2022
1 parent 66b10c1 commit db26596
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 42 deletions.
25 changes: 10 additions & 15 deletions edgedb/errors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@
'TypeSpecNotFoundError',
'UnexpectedMessageError',
'InputDataError',
'ParameterTypeMismatchError',
'StateMismatchError',
'ResultCardinalityMismatchError',
'CapabilityError',
'UnsupportedCapabilityError',
'DisabledCapabilityError',
'StateError',
'StateSerializationError',
'StateMismatchError',
'QueryError',
'InvalidSyntaxError',
'EdgeQLSyntaxError',
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
1 change: 0 additions & 1 deletion edgedb/protocol/consts.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
26 changes: 0 additions & 26 deletions edgedb/protocol/protocol.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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 = <uint32_t>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

Expand Down

0 comments on commit db26596

Please sign in to comment.