Skip to content

Commit

Permalink
[Buck2] Starlark UnpackValue to return starlark::Error
Browse files Browse the repository at this point in the history
Summary: Change Unpack functions to return `starlark::Error` instead of `anyhow::Error`. Helps with removing a bunch of `from_any` in the code and reduces the amount of conversion from starlark->anyhow

Test Plan: CI

Reviewed By: JakobDegen

Differential Revision: D67806044

fbshipit-source-id: 6a6d5c490cbb2cfdc5eb2886b6c498e5d891dd45
  • Loading branch information
Will-MingLun-Li authored and facebook-github-bot committed Jan 9, 2025
1 parent 208b68c commit 1a2a34f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion antlir/bzl/shape2/bzl2ir.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,11 @@ fn shape(builder: &mut GlobalsBuilder) {
.iterate(eval.heap())
.map_err(starlark::Error::into_anyhow)
.context("while collecting enum variants")?
.map(|v| String::unpack_param(v).map(|s| s.into()))
.map(|v| {
String::unpack_param(v)
.map(|s| s.into())
.map_err(starlark::Error::into_anyhow)
})
.collect::<anyhow::Result<_>>()?;
let enm = ir::Enum {
options,
Expand Down

0 comments on commit 1a2a34f

Please sign in to comment.