Skip to content

Commit 6d8f97e

Browse files
author
Zhen
committed
Rebased upon parameter pre-parsing
1 parent 3adbfa4 commit 6d8f97e

File tree

3 files changed

+4
-10
lines changed

3 files changed

+4
-10
lines changed

neo4j/bolt/connection.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,7 @@ def append(self, signature, fields=(), response=None):
239239
log_info("C: INIT (%r, {...})", fields[0])
240240
else:
241241
raise ValueError("Unknown message signature")
242-
try:
243-
self.packer.pack_struct(signature, fields)
244-
except ValueError as e:
245-
# We failed to pack this message, therefore we close this connection to avoid sending corrupted data
246-
self.close()
247-
raise e
242+
self.packer.pack_struct(signature, fields)
248243
self.output_buffer.chunk()
249244
self.output_buffer.chunk()
250245
self.responses.append(response)

neo4j/v1/api.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -614,8 +614,7 @@ def rollback(self):
614614
def close(self):
615615
""" Close this transaction, triggering either a COMMIT or a ROLLBACK.
616616
"""
617-
conn_closed = self.session._connection.closed()
618-
if not self.closed() and not conn_closed:
617+
if not self.closed():
619618
try:
620619
self.sync()
621620
except CypherError:

test/integration/test_session.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -435,14 +435,14 @@ def test_should_sync_after_rollback(self):
435435

436436
def test_errors_on_write_transaction(self):
437437
session = self.driver.session()
438-
with self.assertRaises(ValueError):
438+
with self.assertRaises(TypeError):
439439
session.write_transaction(lambda tx, uuid : tx.run("CREATE (a:Thing {uuid:$uuid})", uuid=uuid), uuid4())
440440
session.close()
441441

442442
def test_errors_on_run_transaction(self):
443443
session = self.driver.session()
444444
tx = session.begin_transaction()
445-
with self.assertRaises(ValueError):
445+
with self.assertRaises(TypeError):
446446
tx.run("CREATE (a:Thing {uuid:$uuid})", uuid=uuid4())
447447
tx.rollback()
448448
session.close()

0 commit comments

Comments
 (0)