docs: Document database exceptions#571
Open
loopassembly wants to merge 1 commit into
Open
Conversation
1 task
Contributor
There was a problem hiding this comment.
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
updateByIdsection 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
updateByIddocs 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.mdgit diff --checkI did not run a docs build because
serverpod_docs/AGENTS.mdsays not to run build commands locally.Closes serverpod/serverpod#3281