From ad3bbd36494c0fbb7d46a3f4c2dd763a8eeea2ec Mon Sep 17 00:00:00 2001 From: Emilia Allison Date: Fri, 15 Nov 2024 15:27:18 -0600 Subject: [PATCH] fix: Typo in transfer validation --- plate-tool-lib/src/transfer_region.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plate-tool-lib/src/transfer_region.rs b/plate-tool-lib/src/transfer_region.rs index 26dbc3f..a2227a2 100644 --- a/plate-tool-lib/src/transfer_region.rs +++ b/plate-tool-lib/src/transfer_region.rs @@ -131,10 +131,8 @@ impl TransferRegion { pub fn calculate_map(&self) -> Box Option> + '_> { // By validating first, we have a stronger guarantee that // this function will not panic. :) - // log::debug!("Validating: {:?}", self.validate()); if let Err(msg) = self.validate() { - eprintln!("{}", msg); - eprintln!("This transfer will be empty."); + log::error!("{}\nThis transfer will be empty.", msg); return Box::new(|_| None); } @@ -308,11 +306,15 @@ impl TransferRegion { // log::debug!("s1.1: {}, max.1: {}", s1.1, source_max.1); return Err("Source region is out-of-bounds! (Too wide)"); } + + if il_dest == (0,0) { + return Err("Refusing to pool both dimensions in a rectangular transfer!\nPlease select a point in the destination plate.") + } } Region::Custom(_) => return Ok(()), } - if il_source.0 == 0 || il_dest.1 == 0 { + if il_source.0 == 0 || il_source.1 == 0 { return Err("Source interleave cannot be zero!"); }