From b1632f2682161726ec569436e4127df30c2a8fbb Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Sun, 19 May 2024 14:43:44 +0800 Subject: [PATCH] chore: log --- frb_example/flutter_via_create/rust/src/api/simple.rs | 2 ++ frb_example/flutter_via_create/rust/src/frb_generated.rs | 3 ++- frb_rust/src/handler/implementation/handler.rs | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/frb_example/flutter_via_create/rust/src/api/simple.rs b/frb_example/flutter_via_create/rust/src/api/simple.rs index 4360c82ae0..87348798f7 100644 --- a/frb_example/flutter_via_create/rust/src/api/simple.rs +++ b/frb_example/flutter_via_create/rust/src/api/simple.rs @@ -5,6 +5,8 @@ pub fn greet(name: String) -> String { #[flutter_rust_bridge::frb(init)] pub fn init_app() { + flutter_rust_bridge::console_error!("hi call simple::init_app START"); // Default utilities - feel free to customize flutter_rust_bridge::setup_default_user_utils(); + flutter_rust_bridge::console_error!("hi call simple::init_app END"); } diff --git a/frb_example/flutter_via_create/rust/src/frb_generated.rs b/frb_example/flutter_via_create/rust/src/frb_generated.rs index a65cf8afb9..6df1aafe78 100644 --- a/frb_example/flutter_via_create/rust/src/frb_generated.rs +++ b/frb_example/flutter_via_create/rust/src/frb_generated.rs @@ -92,8 +92,9 @@ fn wire__crate__api__simple__init_app_impl( let mut deserializer = flutter_rust_bridge::for_generated::SseDeserializer::new(message); deserializer.end(); - flutter_rust_bridge::console_error!("hi call wire__crate__api__simple__init_app_impl INSIDE"); + flutter_rust_bridge::console_error!("hi call wire__crate__api__simple__init_app_impl INSIDE 1"); move |context| { + flutter_rust_bridge::console_error!("hi call wire__crate__api__simple__init_app_impl INSIDE 2"); transform_result_sse( (move || Result::<_, ()>::Ok(crate::api::simple::init_app()))(), ) diff --git a/frb_rust/src/handler/implementation/handler.rs b/frb_rust/src/handler/implementation/handler.rs index 47fe337bf4..4a0ee46677 100644 --- a/frb_rust/src/handler/implementation/handler.rs +++ b/frb_rust/src/handler/implementation/handler.rs @@ -16,6 +16,7 @@ use crate::thread_pool::BaseThreadPool; use std::future::Future; use std::panic; use std::panic::AssertUnwindSafe; +use crate::console_error; /// The default handler used by the generated code. pub type DefaultHandler = @@ -165,16 +166,23 @@ impl SimpleHandler { // ref https://doc.rust-lang.org/nomicon/unwinding.html let _ = panic::catch_unwind(AssertUnwindSafe(move || { let task_info2 = task_info.clone(); + console_error!("hi wrap_normal_or_async 1"); if let Err(error) = PanicBacktrace::catch_unwind(AssertUnwindSafe(move || { + console_error!("hi wrap_normal_or_async 2"); let task = prepare(); + console_error!("hi wrap_normal_or_async 3"); execute(task_info2, task); + console_error!("hi wrap_normal_or_async 4"); })) { + console_error!("hi wrap_normal_or_async 5"); handle_non_sync_panic_error::( self.error_listener, task_info.port.unwrap(), error, ); + console_error!("hi wrap_normal_or_async 6"); } + console_error!("hi wrap_normal_or_async 7"); })); } }