Skip to content

Resurface original error on rollback failure - #14261

Open
bursauxa wants to merge 8 commits into
playframework:mainfrom
bursauxa:fix/14260-withtransaction-hides-cause
Open

bursauxa wants to merge 8 commits into
playframework:mainfrom
bursauxa:fix/14260-withtransaction-hides-cause

Conversation

@bursauxa

Copy link
Copy Markdown
Contributor

Fixes #14260 by resurfacing original error on rollback failure.

No tests added as this is not testable with H2 (see note in issue).

Also, I am not sure that the "restore isolation level" step makes much sense, as the connection is closed immediately after (by withConnection -> finally). I kept it and safeguarded it like the rollback, let me know what you think.

@cchantep cchantep left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Tests would also be nice

Comment thread persistence/play-jdbc/src/main/scala/play/api/db/Databases.scala Outdated
Comment thread persistence/play-jdbc/src/main/scala/play/api/db/Databases.scala
Comment thread persistence/play-jdbc/src/main/scala/play/api/db/Databases.scala Outdated
@bursauxa

Copy link
Copy Markdown
Contributor Author

CI seems to be failing because of a configuration issue ? Does not seem related to this PR

sbt connection file /home/runner/work/playframework/playframework/project/target/active.json is corrupt or unreadable: sjsonnew.shaded.org.typelevel.jawn.IncompleteParseException: exhausted input; starting a new server
[info] sbt server is booting up
[error] failed to connect to server

@bursauxa

Copy link
Copy Markdown
Contributor Author

@cchantep

Tests would also be nice

Can you clarify what kind of tests you mean? As I explained, the current testing framework with in-memory H2 can not cover the cases here. We could integrate the scenarios provided in the reproduction repo linked in issue, but that would mean adding TestContainers dependencies, it is not such a light decision.

@cchantep

Copy link
Copy Markdown
Member

@cchantep

Tests would also be nice

Can you clarify what kind of tests you mean? As I explained, the current testing framework with in-memory H2 can not cover the cases here. We could integrate the scenarios provided in the reproduction repo linked in issue, but that would mean adding TestContainers dependencies, it is not such a light decision.

Using mock

Comment thread persistence/play-jdbc/src/test/scala/play/api/db/DatabasesSpec.scala Outdated
Comment thread persistence/play-jdbc/src/main/scala/play/api/db/Databases.scala

@cchantep cchantep left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

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.

Database.withTransaction hides the error that broke the transaction

2 participants