From 82834718ce9cbb08318c3f19ce634bc9240775b6 Mon Sep 17 00:00:00 2001 From: Andrew Pan Date: Tue, 30 Jan 2024 17:32:55 -0600 Subject: [PATCH] gen/pb-rust: more errors in build script Signed-off-by: Andrew Pan --- gen/pb-rust/sigstore-protobuf-specs/build.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gen/pb-rust/sigstore-protobuf-specs/build.rs b/gen/pb-rust/sigstore-protobuf-specs/build.rs index be3e82c5..61d77f06 100644 --- a/gen/pb-rust/sigstore-protobuf-specs/build.rs +++ b/gen/pb-rust/sigstore-protobuf-specs/build.rs @@ -1,9 +1,16 @@ +use anyhow::Context; + /// Find the standard protobuf include directory. fn protobuf_include_path() -> String { let mut protobuf_root = which::which("protoc") - .ok() + .context("couldn't find protoc!") // dirname(/bin/protoc) / ../ - .and_then(|path| path.ancestors().nth(2).map(|p| p.to_path_buf())) + .and_then(|path| { + path.ancestors() + .nth(2) + .map(|p| p.to_path_buf()) + .with_context(|| format!("couldn't traverse path: {path:?}")) + }) .expect("protobuf installation directory not found!"); protobuf_root.push("include"); protobuf_root.to_str().unwrap().to_owned()