fix unwrap (#6825)
* fix unwrap Signed-off-by: Jess Frazelle <github@jessfraz.com> * add test Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * udaptes Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
@ -407,8 +407,15 @@ impl Args {
|
||||
})
|
||||
})?;
|
||||
|
||||
// TODO unnecessary cloning
|
||||
Ok(T::from_kcl_val(&arg).unwrap())
|
||||
T::from_kcl_val(&arg).ok_or_else(|| {
|
||||
KclError::Semantic(KclErrorDetails {
|
||||
source_ranges: vec![self.source_range],
|
||||
message: format!(
|
||||
"This function expected the input argument to be {}",
|
||||
ty.human_friendly_type(),
|
||||
),
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// Add a modeling command to the batch but don't fire it right away.
|
||||
|
Reference in New Issue
Block a user