use custom errors in VmcExtOpt
This commit is contained in:
		
							parent
							
								
									a91a39ecbe
								
							
						
					
					
						commit
						5aebb1cc63
					
				| 
						 | 
					@ -1049,9 +1049,9 @@ impl MessageBehavior for VmcExtOpt {
 | 
				
			||||||
            args: vec![OscType::from(self.option.to_owned())],
 | 
					            args: vec![OscType::from(self.option.to_owned())],
 | 
				
			||||||
        };
 | 
					        };
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    fn from_osc_message(msg: OscMessage) -> Result<Self, String> {
 | 
					    fn from_osc_message(msg: OscMessage) -> Result<Self, FromMessageErr> {
 | 
				
			||||||
        if msg.args.len() != 1 {
 | 
					        if msg.args.len() != 1 {
 | 
				
			||||||
            return Err(String::from("arg count invalid"));
 | 
					            return Err(FromMessageErr::ArgCount(ArgCountErr { expected_in: vec![1], actual: msg.args.len(), addr: msg.addr}));
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        match &msg.args[0] {
 | 
					        match &msg.args[0] {
 | 
				
			||||||
            OscType::String(s) => {
 | 
					            OscType::String(s) => {
 | 
				
			||||||
| 
						 | 
					@ -1059,7 +1059,7 @@ impl MessageBehavior for VmcExtOpt {
 | 
				
			||||||
                    option: s.to_owned(),
 | 
					                    option: 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})),
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user