ORM-01: Add Error and a Result alias #1
Labels
No labels
area:core
area:database
area:migrations
area:model
area:relations
area:schema
area:tests
breaking-change
size:M
size:S
tracking
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
NoctisWolfshadow/tessera-orm#1
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Depends on: none
Context
Every fallible call returns
rusqlite::Resulttoday. Migrations (checksum drift, invalid lists) and relations (NotPersisted) need errors that are not SQLite errors, so the crate needs its own error type before anything else is built on top of it.Tasks
src/error.rswith a#[non_exhaustive] pub enum Error, starting withSqlite(rusqlite::Error),NotConnected,AlreadyConnected,NotPersisted,NotFound. Later issues add variants.pub type Result<T> = std::result::Result<T, Error>.Display,std::error::Error(withsource()) andFrom<rusqlite::Error>. No new dependency.ErrorandResultfromlib.rs.Model::insert,Query::allandQuery::firstto the newResult.Model::from_rowkeeps returningrusqlite::Result.Example
?keeps working on rusqlite calls inside functions that return the newResult:Acceptance criteria
?changes.Error::source()returns the wrapped rusqlite error forError::Sqlite.cargo testandcargo clippyare green.Model#3Configbuilder #5Migration,MigrationListand checksum #9