fix: doc open sync (#4732)

* chore: bump client api

* fix: open document and folder

* chore: bump collab rev

* chore: fix wasm build

* chore: fix warnings
This commit is contained in:
Nathan.fooo
2024-02-25 07:49:44 +08:00
committed by GitHub
parent 4ca3ba8e08
commit c3e5aa29fc
20 changed files with 295 additions and 221 deletions

View File

@ -30,6 +30,7 @@ url = { version = "2.2", optional = true }
collab-database = { version = "0.1.0", optional = true }
collab-document = { version = "0.1.0", optional = true }
collab-plugins = { version = "0.1.0", optional = true }
collab-folder = { version = "0.1.0", optional = true }
client-api = { version = "0.1.0", optional = true }
[features]
@ -38,6 +39,7 @@ impl_from_serde = []
impl_from_reqwest = ["reqwest"]
impl_from_collab_persistence = ["collab-plugins"]
impl_from_collab_document = ["collab-document", "impl_from_reqwest", "collab-plugins"]
impl_from_collab_folder = ["collab-folder"]
impl_from_collab_database= ["collab-database"]
impl_from_url = ["url"]

View File

@ -64,6 +64,10 @@ impl FlowyError {
self.code == ErrorCode::UserUnauthorized || self.code == ErrorCode::RecordNotFound
}
pub fn is_invalid_data(&self) -> bool {
self.code == ErrorCode::InvalidParams
}
pub fn is_local_version_not_support(&self) -> bool {
self.code == ErrorCode::LocalVersionNotSupport
}

View File

@ -15,6 +15,22 @@ impl From<DatabaseError> for FlowyError {
#[cfg(feature = "impl_from_collab_document")]
impl From<DocumentError> for FlowyError {
fn from(error: DocumentError) -> Self {
FlowyError::internal().with_context(error)
match error {
DocumentError::NoRequiredData => FlowyError::invalid_data().with_context(error),
_ => FlowyError::internal().with_context(error),
}
}
}
#[cfg(feature = "impl_from_collab_folder")]
use collab_folder::error::FolderError;
#[cfg(feature = "impl_from_collab_folder")]
impl From<FolderError> for FlowyError {
fn from(error: FolderError) -> Self {
match error {
FolderError::NoRequiredData(_) => FlowyError::invalid_data().with_context(error),
_ => FlowyError::internal().with_context(error),
}
}
}