mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2025-08-12 10:51:28 +00:00

* refactor: user manager * refactor: user manager * refactor: session location * refactor: user manager * chore: gen ts files * feat: implement indexeddb persistence * chore: integrate user manager * chore: update * chore: run on web thread * chore: run on web thread * chore: fix test * chore: add test * chore: add test * chore: add user & sign in with password * chore: fix test * chore: update docs * chore: fix warnings * chore: gen files * chore: add user * chore: add files * chore: update config * chore: update scirpt * chore: update scirpt * fix: build * chore: update command * fix: ci * ci: fix * fix: compile * fix: compile * fix: ci * fix: compile * fix: tauri build * chore: fix test * chore: fix test
31 lines
859 B
Rust
31 lines
859 B
Rust
use flowy_error::FlowyError;
|
|
use web_sys::DomException;
|
|
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum PersistenceError {
|
|
#[error(transparent)]
|
|
Internal(#[from] anyhow::Error),
|
|
|
|
#[error(transparent)]
|
|
SerdeError(#[from] serde_json::Error),
|
|
|
|
#[error("{0}")]
|
|
RecordNotFound(String),
|
|
}
|
|
|
|
impl From<DomException> for PersistenceError {
|
|
fn from(value: DomException) -> Self {
|
|
PersistenceError::Internal(anyhow::anyhow!("DOMException: {:?}", value))
|
|
}
|
|
}
|
|
|
|
impl From<PersistenceError> for FlowyError {
|
|
fn from(value: PersistenceError) -> Self {
|
|
match value {
|
|
PersistenceError::Internal(value) => FlowyError::internal().with_context(value),
|
|
PersistenceError::SerdeError(value) => FlowyError::serde().with_context(value),
|
|
PersistenceError::RecordNotFound(value) => FlowyError::record_not_found().with_context(value),
|
|
}
|
|
}
|
|
}
|