diff --git a/README.md b/README.md index 4533916..c0772f1 100644 --- a/README.md +++ b/README.md @@ -165,7 +165,7 @@ Default configuration: relative_goto = 50, absolute_goto = 100, }, - -- Interactions that happen earlier than the cooldown won't be taken into accont when calculating marks' weights + -- Interactions that happen earlier than the cooldown won't be taken into account when calculating marks' weights cooldown_seconds = 60, }, } diff --git a/macros/src/lib.rs b/macros/src/lib.rs index 7544857..7115b29 100644 --- a/macros/src/lib.rs +++ b/macros/src/lib.rs @@ -15,7 +15,17 @@ pub fn derive_deserializing_from_lua(input: TokenStream) -> TokenStream { impl nvim_oxi::conversion::FromObject for #ident { fn from_object(obj: nvim_oxi::Object) -> core::result::Result { use serde::Deserialize; - Self::deserialize(nvim_oxi::serde::Deserializer::new(obj)).map_err(Into::into) + Ok(match Self::deserialize(nvim_oxi::serde::Deserializer::new(obj)).map_err(nvim_oxi::conversion::Error::from) { + Ok(v) => v, + Err(e) => { + let _ = nvim_oxi::api::notify( + &format!("Bad compass function input: {}. Using defaults instead", e.to_string()), + nvim_oxi::api::types::LogLevel::Error, + &nvim_oxi::api::opts::NotifyOpts::builder().build(), + ); + Self::default() + }, + }) } }