diff --git a/Cargo.lock b/Cargo.lock index e827963..42ea19a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1543,6 +1543,7 @@ dependencies = [ "gloo-net", "hex", "js-sys", + "log", "nrpc 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)", "obfstr", "prost", diff --git a/usdpl-build/src/front/service_generator.rs b/usdpl-build/src/front/service_generator.rs index 584fc45..4297795 100644 --- a/usdpl-build/src/front/service_generator.rs +++ b/usdpl-build/src/front/service_generator.rs @@ -24,6 +24,7 @@ fn generate_service_methods( ) -> proc_macro2::TokenStream { let mut gen_methods = Vec::with_capacity(service.methods.len()); for method in &service.methods { + let method_name_str = method.name.clone(); let method_name = quote::format_ident!("{}", method.name); let method_input = quote::format_ident!("{}{}", &service.name, method.input_type); let method_output = quote::format_ident!("{}{}Wasm", &service.name, method.output_type); @@ -88,8 +89,9 @@ fn generate_service_methods( let x2: #method_output_as_in = x.into(); Some(x2.into_wasm()) }, - Err(_e) => { - // TODO log error + Err(e) => { + // log error + log::error!("service:{}|method:{}|error:{}", self.service.descriptor(), #method_name_str, e); None } } @@ -468,6 +470,7 @@ impl ProtobufType { //"sfixed64" => quote::quote!{i64}, 8 => Self::Bool, 9 => Self::String, + 13 => Self::Uint32, //"bytes" => quote::quote!{Vec}, t => Self::Custom(format!("UnknownType{}", t)), } @@ -811,6 +814,9 @@ impl IServiceGenerator for WasmServiceGenerator { use usdpl_front::_helpers::wasm_bindgen; use usdpl_front::_helpers::wasm_bindgen_futures; use usdpl_front::_helpers::js_sys; + use usdpl_front::_helpers::log; + + use ::nrpc::ClientService; use usdpl_front::wasm::*; diff --git a/usdpl-front/Cargo.toml b/usdpl-front/Cargo.toml index a28ea0e..36ad139 100644 --- a/usdpl-front/Cargo.toml +++ b/usdpl-front/Cargo.toml @@ -47,6 +47,7 @@ hex = { version = "0.4", optional = true } nrpc = "0.6" usdpl-core = { version = "0.11", path = "../usdpl-core" } prost = "0.11" +log = "0.4" [dev-dependencies] wasm-bindgen-test = { version = "0.3.13" } diff --git a/usdpl-front/src/lib.rs b/usdpl-front/src/lib.rs index 96942aa..af5f3f6 100644 --- a/usdpl-front/src/lib.rs +++ b/usdpl-front/src/lib.rs @@ -22,6 +22,7 @@ pub mod _helpers { pub use js_sys; pub use wasm_bindgen; pub use wasm_bindgen_futures; + pub use log; } use std::sync::atomic::{AtomicU64, Ordering};