From c2e859273db5104341eeeb6fdb5c94d2d0fbc2a9 Mon Sep 17 00:00:00 2001 From: Michael Goldenberg Date: Thu, 1 May 2025 11:43:20 -0400 Subject: [PATCH] refactor(indexeddb): add enum for general IndexedDB serialization errors Signed-off-by: Michael Goldenberg --- .../src/crypto_store/indexeddb_serializer.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/crates/matrix-sdk-indexeddb/src/crypto_store/indexeddb_serializer.rs b/crates/matrix-sdk-indexeddb/src/crypto_store/indexeddb_serializer.rs index 6237403bb..40dde29cb 100644 --- a/crates/matrix-sdk-indexeddb/src/crypto_store/indexeddb_serializer.rs +++ b/crates/matrix-sdk-indexeddb/src/crypto_store/indexeddb_serializer.rs @@ -39,6 +39,24 @@ pub struct IndexeddbSerializer { store_cipher: Option>, } +#[allow(dead_code)] +#[derive(Debug, thiserror::Error)] +pub enum IndexeddbSerializerError { + #[error(transparent)] + Serialization(#[from] serde_json::Error), + #[error("DomException {name} ({code}): {message}")] + DomException { + /// DomException code + code: u16, + /// Specific name of the DomException + name: String, + /// Message given to the DomException + message: String, + }, + #[error(transparent)] + CryptoStoreError(#[from] CryptoStoreError), +} + #[derive(Debug, Deserialize, Serialize)] #[serde(untagged)] pub enum MaybeEncrypted {