docs: Document transaction failure exceptions#572
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds guidance on handling exceptions thrown during transactions and clarifies how to detect/retry on common PostgreSQL concurrency errors, while also tightening up the transaction isolation table formatting/spelling.
Changes:
- Documented how Serverpod rolls back/rethrows on transaction callback exceptions and how database rejections surface as
DatabaseQueryException. - Added a Dart example for checking
DatabaseQueryException.codeagainstPgErrorCode(e.g., serialization failure, deadlock). - Updated the transaction isolation table header formatting and corrected “PostgresSQL” → “PostgreSQL”.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Thanks for the review notes. I pushed a small follow-up commit ( I also checked the table comment. The table is already using normal single-pipe Markdown syntax, and the latest title, markdown-lint, and Docusaurus test-build checks are all green now. |
Swiftaxe
left a comment
There was a problem hiding this comment.
Thank you! Looks really good and accurate. Just added a couple of nit comments.
|
|
||
| ## Transaction failure exceptions | ||
|
|
||
| When the transaction callback throws an exception, Serverpod rolls back the |
There was a problem hiding this comment.
This line is a repetition of line 7, and can be omitted.
| When the transaction callback throws an exception, Serverpod rolls back the | ||
| transaction and rethrows that exception. | ||
|
|
||
| When the database rejects a query inside the transaction, Serverpod throws a |
There was a problem hiding this comment.
The lines hard-wrap at 72 characters. Unwrap to match the rest of the file. (e.g. remove the invisible break line character).
Summary
DatabaseQueryException.DatabaseQueryException.codewithPgErrorCode.serializationFailureandPgErrorCode.deadlockDetected.Verification
npx --yes --cache ./.npm-cache markdownlint-cli docs/06-concepts/06-database/08-transactions.mdgit diff --checkI did not run a docs build because
serverpod_docs/AGENTS.mdsays not to run build commands locally.Closes serverpod/serverpod#3920