diff --git a/crates/matrix-sdk-crypto/src/store/mod.rs b/crates/matrix-sdk-crypto/src/store/mod.rs index 53ad1c927..7f99dedee 100644 --- a/crates/matrix-sdk-crypto/src/store/mod.rs +++ b/crates/matrix-sdk-crypto/src/store/mod.rs @@ -597,6 +597,14 @@ pub enum CryptoStoreError { /// The store failed to (de)serialize a data type. #[error(transparent)] Serialization(#[from] SerdeError), + + /// The database format has changed in a backwards incompatible way. + #[error( + "The database format changed in an incompatible way, current \ + version: {0}, latest version: {1}" + )] + UnsupportedDatabaseVersion(usize, usize), + /// A problem with the underlying database backend #[error(transparent)] Backend(#[from] anyhow::Error), diff --git a/crates/matrix-sdk-sled/src/cryptostore.rs b/crates/matrix-sdk-sled/src/cryptostore.rs index e4f5be50f..c5fb34698 100644 --- a/crates/matrix-sdk-sled/src/cryptostore.rs +++ b/crates/matrix-sdk-sled/src/cryptostore.rs @@ -486,11 +486,10 @@ impl SledStore { } if version <= 3 { - return Err(anyhow!( - "Unsupported database version, the database \ - format changed in a backwards incompatible way" - ) - .into()); + return Err(CryptoStoreError::UnsupportedDatabaseVersion( + version.into(), + DATABASE_VERSION.into(), + )); } self.inner