//! Every way the store refuses.//!//! The named migration error (`Migration`) plus the two//! shapes the driver and the codecs need. The MESSAGES matter: the Mac's//! window and the phone's boot screen render them, and the conformance//! harness compares the reason strings a rejection carries — so the wording//! is fixed, never reinvented.use std::fmt;/// The result every fallible call in this crate returns.pubtypeResult<T> = std::result::Result<T, StoreError>;#[derive(Debug, thiserror::Error)]pubenumStoreError {/// SQLite said no. #[error("sqlite: {0}")]Sqlite(#[from] rusqlite::Error),/// An open that failed one of its assertions — `PRAGMA foreign_keys` off,/// FTS5 missing, a second identity in a file that already has one. The/// file is untouched. #[error("{0}")]Refused(String),/// A value could not be encoded into (or decoded out of) its column's/// codec. Carries the TypeScript `TypeError` message verbatim. #[error("{0}")]Encode(String),/// One migration step failed, and the file is exactly as it was before it:/// the step ran inside a transaction that has already been rolled back. #[error("cotton-store: migration {version} failed (file {from} → {to}); it ran in a transaction \ and has been rolled back, so the file is unchanged at version {from} and running the \ migration again is safe: {source}" )]Migration { version: u32, from: u32, to: u32, source: Box<StoreError>, },}implFrom<cotton_rules::fingerprint::EncodeError> forStoreError {fn from(error: cotton_rules::fingerprint::EncodeError) -> Self {StoreError::Encode(error.0) }}implStoreError {/// A `TypeError`-shaped refusal from a codec.pubfn encode(message: impl fmt::Display) -> Self {StoreError::Encode(message.to_string()) }/// An open (or a seed) that failed its assertions.pubfn refused(message: impl fmt::Display) -> Self {StoreError::Refused(message.to_string()) }}