summaryrefslogtreecommitdiff
path: root/src/db/mod.rs
diff options
context:
space:
mode:
authorojacobson <ojacobson@noreply.codeberg.org>2025-07-23 00:23:10 +0200
committerojacobson <ojacobson@noreply.codeberg.org>2025-07-23 00:23:10 +0200
commitaec3eaeebd37bce9ab4dad14e7e86ef0db8f0c2d (patch)
tree98b1c0f92a35d91dafc2dd7b56b32260a3d2b6d9 /src/db/mod.rs
parent64639acbab02aa4103cbe44199e38991269b2137 (diff)
parent792de8e49fa8a3c04bfb747adadf71572d753055 (diff)
Fix some minor weirdness when Pilcrow is (unwisely) used as a library.
Pilcrow isn't meant to be used as a library, and the only public interface the `pilcrow` lib crate exposes is the CLI entry point. However, we will likely be publishing Pilcrow via crates.io (among other options) one day, and so it will _be usable_ as a library if someone's desperate enough to try. To that end, let's try to be good citizens. This change fixes two issues: * The docs contained links to internal items, which are not actually included in the library documentation. The links are simply removed; the uses of those items were already private anyways. * The CLI `Error` type is no longer part of the public interface, using `impl Trait` (`impl std::error::Error`) shenanigans to hide the error type from callers. (To be clear, this would be _extremely_ rude in code intended for library use.) This frees us up to change the structure of the error type - or to replace it entirely - without making the world's most pedantic semver change in the process. Merges lib-crate-weirdness into main.
Diffstat (limited to 'src/db/mod.rs')
-rw-r--r--src/db/mod.rs8
1 files changed, 0 insertions, 8 deletions
diff --git a/src/db/mod.rs b/src/db/mod.rs
index 632cd9c..99b8986 100644
--- a/src/db/mod.rs
+++ b/src/db/mod.rs
@@ -102,16 +102,12 @@ async fn migration_replaced(
Ok(())
}
-/// Errors occurring during database setup.
#[derive(Debug, thiserror::Error)]
pub enum Error {
- /// Failure due to a database error. See [`sqlx::Error`].
#[error(transparent)]
Database(#[from] sqlx::Error),
- /// Failure because an existing database backup already exists.
#[error("backup from a previous failed migration already exists: {0}")]
BackupExists(String),
- /// Failure due to a database backup error. See [`backup::Error`].
#[error(transparent)]
Backup(#[from] backup::Error),
#[error("migration failed: {1}\nrestoring backup failed: {0}")]
@@ -120,12 +116,8 @@ pub enum Error {
"migration failed: {1}\nrestoring from backup succeeded, but deleting backup failed: {0}"
)]
Drop(sqlx::Error, sqlx::migrate::MigrateError),
- /// Failure due to a database migration error. See
- /// [`sqlx::migrate::MigrateError`].
#[error(transparent)]
Migration(#[from] sqlx::migrate::MigrateError),
- /// Failure because the database contains a migration from an unsupported
- /// schema version.
#[error("database contains rejected migration {0}:{1}, move it aside")]
Rejected(String, String),
}