From f29f1bae32f81182e4410618822f706d97c86600 Mon Sep 17 00:00:00 2001 From: nathan Date: Fri, 9 Feb 2024 10:18:52 +0800 Subject: [PATCH] chore: update error message --- frontend/rust-lib/flowy-folder/src/event_handler.rs | 1 + frontend/rust-lib/flowy-folder/src/manager.rs | 12 +++++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/rust-lib/flowy-folder/src/event_handler.rs b/frontend/rust-lib/flowy-folder/src/event_handler.rs index 7eee016727..a5412decc6 100644 --- a/frontend/rust-lib/flowy-folder/src/event_handler.rs +++ b/frontend/rust-lib/flowy-folder/src/event_handler.rs @@ -102,6 +102,7 @@ pub(crate) async fn create_orphan_view_handler( data_result_ok(view_pb_without_child_views(Arc::new(view))) } +#[tracing::instrument(level = "debug", skip(data, folder), err)] pub(crate) async fn read_view_handler( data: AFPluginData, folder: AFPluginState>, diff --git a/frontend/rust-lib/flowy-folder/src/manager.rs b/frontend/rust-lib/flowy-folder/src/manager.rs index a2e8d951e6..cf782c7586 100644 --- a/frontend/rust-lib/flowy-folder/src/manager.rs +++ b/frontend/rust-lib/flowy-folder/src/manager.rs @@ -455,7 +455,7 @@ impl FolderManager { /// Returns the view with the given view id. /// The child views of the view will only access the first. So if you want to get the child view's /// child view, you need to call this method again. - #[tracing::instrument(level = "debug", skip(self, view_id), err)] + #[tracing::instrument(level = "debug", skip(self))] pub async fn get_view_pb(&self, view_id: &str) -> FlowyResult { let view_id = view_id.to_string(); let folder = self.mutex_folder.lock(); @@ -467,11 +467,17 @@ impl FolderManager { .collect::>(); if trash_ids.contains(&view_id) { - return Err(FlowyError::record_not_found()); + return Err(FlowyError::new( + ErrorCode::RecordNotFound, + format!("View:{} is in trash", view_id), + )); } match folder.views.get_view(&view_id) { - None => Err(FlowyError::record_not_found()), + None => { + error!("Can't find the view with id: {}", view_id); + Err(FlowyError::record_not_found()) + }, Some(view) => { let child_views = folder .views