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:
Jess Frazelle
2025-05-10 13:00:14 -07:00
committed by GitHub
parent 3956958452
commit 7ac4a9507b
10 changed files with 2419 additions and 2 deletions

View File

@ -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.