Skip to content

Adjust transaction lifetime tests for Python #598

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
Oct 6, 2023
Merged

Conversation

robsdedude
Copy link
Contributor

Currently, the tests assert that the driver throws the same error with which the other result failed. I personally don't like it because that error has nothing to do with the result stream being used (but only the other failed stream). So instead I decided to throw some generic ResultFailedError in Python with the other error as context information for easier debugging.

However, all of this is fool proofing of the drivers. Users will never encounter this error unless they're abusing the driver or doing really funky stuff with it. So I don't have a strong opinion about what exact error we should throw. The main focus should be on preventing the driver from sending invalid messages to the server and ideally throwing any error that's not absolutely cryptic.

Currently, the tests assert that the driver throws the same error with which
the other result failed. I personally don't like it because that error has
nothing to do with the result stream being used (but only the other failed
stream). So instead I decided to throw some generic `ResultFailedError` in
Python with the other error as context information for easier debugging.

However, all of this is fool proofing of the drivers. Users will never encounter
this error unless they're abusing the driver or doing really funky stuff with
it. So I don't have a strong opinion about what exact error we should throw.
The main focus should be on preventing the driver from sending invalid messages
to the server and ideally throwing any error that's not absolutely cryptic.
@@ -343,7 +341,7 @@ def test_should_prevent_run_after_tx_termination_on_run(self):
self._assert_is_client_exception(exc)

with self.assertRaises(types.DriverError) as exc:
tx.run("invalid")
tx.run("RETURN 1 AS n")
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note this change.

I felt it was pointless to send a query here which we know will fail with exactly that Syntax error. The driver should throw even before attempting to send anything.

Copy link
Contributor

@bigmontz bigmontz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧚🏼

@robsdedude robsdedude merged commit af94bf2 into 5.0 Oct 6, 2023
@robsdedude robsdedude deleted the tx-lifetime-python branch October 6, 2023 12:15
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.

2 participants