Skip to content

docs: Document transaction failure exceptions#572

Open
loopassembly wants to merge 1 commit into
serverpod:mainfrom
loopassembly:docs/transaction-failure-exceptions
Open

docs: Document transaction failure exceptions#572
loopassembly wants to merge 1 commit into
serverpod:mainfrom
loopassembly:docs/transaction-failure-exceptions

Conversation

@loopassembly
Copy link
Copy Markdown

Summary

  • Add guidance for exceptions thrown when transactions fail.
  • Document that database-rejected queries inside a transaction surface as DatabaseQueryException.
  • Show how to compare DatabaseQueryException.code with PgErrorCode.serializationFailure and PgErrorCode.deadlockDetected.
  • Fix the transactions isolation table markdown formatting and a PostgreSQL typo in the touched page.

Verification

  • npx --yes --cache ./.npm-cache markdownlint-cli docs/06-concepts/06-database/08-transactions.md
  • git diff --check

I did not run a docs build because serverpod_docs/AGENTS.md says not to run build commands locally.

Closes serverpod/serverpod#3920

Copilot AI review requested due to automatic review settings June 3, 2026 09:06
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.code against PgErrorCode (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.

Comment on lines +61 to +62
For all PostgreSQL error codes, see the [PostgreSQL error code
appendix](https://www.postgresql.org/docs/current/errcodes-appendix.html).
Comment on lines +90 to +92
| Isolation Level | Constant | Description |
| --- | --- | --- |
| Read uncommitted | `IsolationLevel.readUncommitted` | Exhibits the same behavior as `IsolationLevel.readCommitted` in PostgreSQL |
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.

Transaction failures throw which specific exceptions?

2 participants