Skip to content
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
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ See also https://github.com/neo4j/neo4j-python-driver/wiki for a full changelog.
- `connection_acquisition_timeout` configuration option
- `ValueError` on invalid values (instead of `ClientError`)
- Consistently restrict the value to be strictly positive
- `TransactionError` (subclass of `DriverError`) instead of `ClientError` (subclass of `Neo4jError`) when calling
`session.run()` while an explicit transaction is active on that session.
- This improves the differentiation between `DriverError` for client-side errors and `Neo4jError` for server-side
errors.
- It is now the same error raised as when trying to start an explicit transaction while another explicit transaction
is already active.


## Version 5.28
Expand Down
7 changes: 3 additions & 4 deletions src/neo4j/_async/work/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
WRITE_ACCESS,
)
from ...exceptions import (
ClientError,
DriverError,
Neo4jError,
ServiceUnavailable,
Expand Down Expand Up @@ -293,6 +292,7 @@ async def run(

:returns: a new :class:`neo4j.AsyncResult` object

:raises TransactionError: if a transaction is already open.
:raises SessionError: if the session has been closed.
"""
self._check_state()
Expand All @@ -302,9 +302,8 @@ async def run(
raise TypeError("query must be a string or a Query instance")

if self._transaction:
# TODO: 6.0 - change this to be a TransactionError
raise ClientError(
"Explicit Transaction must be handled explicitly"
raise TransactionError(
self._transaction, "Explicit transaction already open"
)

if self._auto_result:
Expand Down
7 changes: 3 additions & 4 deletions src/neo4j/_sync/work/session.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.