Skip to content

docs: Document database exceptions#571

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

docs: Document database exceptions#571
loopassembly wants to merge 1 commit into
serverpod:mainfrom
loopassembly:docs/database-exceptions

Conversation

@loopassembly
Copy link
Copy Markdown

Summary

  • Add a database exceptions page that documents the public Serverpod database exception types.
  • Cover query exception metadata, row-level operation exceptions, and SQLite foreign key integrity checks.
  • Link the CRUD updateById docs to the new exceptions page.

Verification

  • npx --yes --cache ./.npm-cache markdownlint-cli docs/06-concepts/06-database/15-exceptions.md docs/06-concepts/06-database/05-crud.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#3281

Copilot AI review requested due to automatic review settings June 3, 2026 08:51
@loopassembly loopassembly changed the title docs: document database exceptions docs: Document database exceptions Jun 3, 2026
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 documentation covering Serverpod database exception types and how to handle them, and links the CRUD guide to this new reference.

Changes:

  • Added a new “Database exceptions” concept page with exception taxonomy and examples.
  • Linked the CRUD updateById section to the new exceptions documentation.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
docs/06-concepts/06-database/15-exceptions.md Introduces a new page documenting database exception behavior and types.
docs/06-concepts/06-database/05-crud.md Adds a cross-link from CRUD docs to the new exceptions page.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +33 to +41
| Exception | When it is thrown |
| --- | --- |
| `DatabaseException` | The common interface for database exceptions. Catch this when you want one handler for any database failure. |
| `DatabaseQueryException` | A query failed in the database adapter, often because the database rejected the SQL or a constraint was violated. |
| `DatabaseInsertRowException` | A single-row insert operation did not insert exactly one row. |
| `DatabaseUpdateRowException` | A single-row update operation did not update the expected row, for example when `updateById` receives an id that does not exist. |
| `DatabaseDeleteRowException` | A single-row delete operation did not delete the expected row. |
| `DatabaseUpsertRowException` | A single-row upsert operation unexpectedly returned more than one row. |
| `SqliteForeignKeyViolationException` | A SQLite foreign key integrity check found one or more violating rows. |

The `updateById` method updates only the specified columns for the row with the given ID. The method returns the updated row, or throws a `DatabaseUpdateRowException` if no row with the given ID exists. At least one column must be specified in the `columnValues` parameter, otherwise an `ArgumentError` will be thrown.

See [Database exceptions](./exceptions) for the full set of database exception types and when they are thrown.
Comment on lines +28 to +29
server exception. Database exceptions are not serializable exceptions sent to
the client with their database details.
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.

Document database exceptions

2 participants