Skip to content

Commit

Permalink
[Buck2] Use Starlark Native Error Kind instead of Other
Browse files Browse the repository at this point in the history
Summary: Changing a few places where the starlark error kind should have been Native instead of Other

Test Plan: CI

Reviewed By: epilatow

Differential Revision: D64123351

fbshipit-source-id: 4223bd760353beb48313e73db27336e7283e1a9b
  • Loading branch information
Will-MingLun-Li authored and facebook-github-bot committed Oct 11, 2024
1 parent ec02f56 commit 80b4a0b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions antlir/bzl/shape2/bzl2ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl<'v> StarlarkValue<'v> for TypeId {
) -> starlark::Result<Value<'v>> {
let reg = get_type_registry(eval)?
.try_borrow()
.map_err(starlark::Error::new_other)?;
.map_err(starlark::Error::new_native)?;
let ty = me.try_to_type(&reg)?;
match ty.as_ref() {
ir::Type::Complex(ir::ComplexType::Struct(_)) => {
Expand All @@ -130,7 +130,7 @@ impl<'v> StarlarkValue<'v> for TypeId {
args.no_named_args()?;
args.positional1(eval.heap())
}
_ => Err(starlark::Error::new_other(anyhow!(
_ => Err(starlark::Error::new_native(anyhow!(
"only structs and enums are callable, not ({ty:#?})"
))),
}
Expand Down Expand Up @@ -358,7 +358,7 @@ fn shape(builder: &mut GlobalsBuilder) {
) -> starlark::Result<TypeId> {
let mut reg = get_type_registry(eval)?
.try_borrow_mut()
.map_err(starlark::Error::new_other)?;
.map_err(starlark::Error::new_native)?;
let types: Vec<_> = args
.iterate(eval.heap())?
.enumerate()
Expand Down

0 comments on commit 80b4a0b

Please sign in to comment.