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

@ -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),
}
}
}