mirror of
https://github.com/matrix-org/matrix-rust-sdk.git
synced 2026-05-10 17:03:20 -04:00
refactor(indexeddb): add conversion IndexeddbSerializerError -> IndexeddbCryptoStoreError
Signed-off-by: Michael Goldenberg <m@mgoldenberg.net>
This commit is contained in:
committed by
Ivan Enderlin
parent
c2e859273d
commit
3f3daef01c
@@ -39,7 +39,6 @@ pub struct IndexeddbSerializer {
|
||||
store_cipher: Option<Arc<StoreCipher>>,
|
||||
}
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[derive(Debug, thiserror::Error)]
|
||||
pub enum IndexeddbSerializerError {
|
||||
#[error(transparent)]
|
||||
|
||||
@@ -21,6 +21,7 @@ use async_trait::async_trait;
|
||||
use gloo_utils::format::JsValueSerdeExt;
|
||||
use hkdf::Hkdf;
|
||||
use indexed_db_futures::prelude::*;
|
||||
use indexeddb_serializer::IndexeddbSerializerError;
|
||||
use js_sys::Array;
|
||||
use matrix_sdk_crypto::{
|
||||
olm::{
|
||||
@@ -148,6 +149,20 @@ pub enum IndexeddbCryptoStoreError {
|
||||
SchemaTooNewError { max_supported_version: u32, current_version: u32 },
|
||||
}
|
||||
|
||||
impl From<IndexeddbSerializerError> for IndexeddbCryptoStoreError {
|
||||
fn from(value: IndexeddbSerializerError) -> Self {
|
||||
match value {
|
||||
IndexeddbSerializerError::Serialization(error) => Self::Serialization(error),
|
||||
IndexeddbSerializerError::DomException { code, name, message } => {
|
||||
Self::DomException { code, name, message }
|
||||
}
|
||||
IndexeddbSerializerError::CryptoStoreError(crypto_store_error) => {
|
||||
Self::CryptoStoreError(crypto_store_error)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<web_sys::DomException> for IndexeddbCryptoStoreError {
|
||||
fn from(frm: web_sys::DomException) -> IndexeddbCryptoStoreError {
|
||||
IndexeddbCryptoStoreError::DomException {
|
||||
|
||||
Reference in New Issue
Block a user