From 3fab3f9a2e4c228aa612efd4ebe05055893e3626 Mon Sep 17 00:00:00 2001 From: Cassandra de la Cruz-Munoz Date: Sun, 31 Dec 2023 12:19:00 -0500 Subject: [PATCH] use custom errors and fix bug in VmcExtConfig --- src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 588f70e..c8805a8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1187,13 +1187,13 @@ impl MessageBehavior for VmcExtConfig { args: vec![OscType::from(self.path.to_owned())], }; } - fn from_osc_message(msg: OscMessage) -> Result { - if msg.addr.len() != 1 { - return Err(String::from("arg count invalid")); + fn from_osc_message(msg: OscMessage) -> Result { + if msg.args.len() != 1 { + return Err(FromMessageErr::ArgCount(ArgCountErr { expected_in: vec![1], actual: msg.args.len(), addr: msg.addr })); } match &msg.args[0] { OscType::String(s) => return Ok(VmcExtConfig { path: s.to_owned() }), - _ => return Err(String::from("arg type invalid")), + _ => return Err(FromMessageErr::ArgType(ArgTypeErr { expected: OscType::String(String::new()), actual: msg.args[0], addr: msg.addr, arg_count: 0})), } } }