Skip to content

Raise on using Results out of transaction scope #652

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

Merged
merged 1 commit into from
Feb 9, 2022

Conversation

robsdedude
Copy link
Member

@robsdedude robsdedude commented Jan 31, 2022

Results are tied to transactions (except auto-commit transactions).
When the transaction ends, the result becomes useless. Raising instead of
silently ignoring this fact will help developers to find potential bugs faster.

Depends on neo4j-drivers/testkit#387

@robsdedude robsdedude force-pushed the error-on-result-out-of-scope branch 3 times, most recently from 09f3390 to 4478986 Compare February 7, 2022 14:17
@robsdedude robsdedude force-pushed the error-on-result-out-of-scope branch 3 times, most recently from 167b0f7 to 444fb88 Compare February 8, 2022 18:27
Results are tied to transactions (except auto-commit transactions).
When the transaction ends, the result becomes useless. Raising instead of
silently ignoring this fact will help developers to find potential bugs faster.

After consuming a Result, there can never be records left. There is meaning in
trying to obtain them. Hence, we raise a ResultError to make the user aware of
potentially wrong code.
@robsdedude robsdedude force-pushed the error-on-result-out-of-scope branch from 444fb88 to 709a91e Compare February 8, 2022 18:29
@robsdedude robsdedude merged commit 3b0778d into neo4j:5.0 Feb 9, 2022
robsdedude added a commit to robsdedude/neo4j-python-driver that referenced this pull request Feb 9, 2022
…j#652)

Results are tied to transactions (except auto-commit transactions).
When the transaction ends, the result becomes useless. Raising instead of
silently ignoring this fact will help developers to find potential bugs faster
and avoid surprising and hard to understand behavior.

After consuming a Result, there can never be records left. There is no meaning
in trying to obtain them. Hence, we raise a `ResultConsumedError` to make the
user aware of likely wrong code.
@robsdedude robsdedude deleted the error-on-result-out-of-scope branch February 9, 2022 10:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant