From f0f2317846d9ae49fbe3eb938f6698c92de0c7d1 Mon Sep 17 00:00:00 2001 From: itowlson Date: Fri, 13 Dec 2024 08:01:27 +1300 Subject: [PATCH] Error if generating bindings for non-existent component Signed-off-by: itowlson --- src/commands/bindings.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/commands/bindings.rs b/src/commands/bindings.rs index 7cfc3b3..f997682 100644 --- a/src/commands/bindings.rs +++ b/src/commands/bindings.rs @@ -34,8 +34,12 @@ impl GenerateBindingsCommand { .join(SPIN_DEPS_WIT_FILE_NAME); if !std::fs::exists(&wit_path)? { - // TODO: warn that the file does not exist - return Ok(()); + anyhow::bail!( + r#"The WIT file that `spin deps` uses to track component dependencies doesn't exist. This can happen if: +* the component name is incorrect +* you've not previously run `spin deps add` for this component +The expected file is {wit_path:?}"# + ); } let mut resolve = Resolve::default();