From eebfae7bb0accd1ee90ef8349362ced0e7452ddd Mon Sep 17 00:00:00 2001 From: Michael Rogenmoser Date: Fri, 10 May 2024 18:59:56 +0200 Subject: [PATCH] Fix dependency mismatch panic --- src/sess.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/src/sess.rs b/src/sess.rs index 013e84d9..9cbf4dc7 100644 --- a/src/sess.rs +++ b/src/sess.rs @@ -179,8 +179,25 @@ impl<'sess, 'ctx: 'sess> Session<'ctx> { // Translate the name-based graph into an ID-based graph. let graph: IndexMap> = graph_names .into_iter() - .map(|(k, v)| (k, v.iter().map(|name| names[name]).collect())) - .collect(); + .map(|(k, v)| { + ( + k, + v.iter() + .map(|name| match names.get(name) { + Some(id) => Ok(*id), + None => Err(Error::new(format!( + "Failed to match dependency {}, please run `bender update`!", + name + ))), + }) + .collect::>(), + ) + }) + .map(|(k, v)| match v { + Ok(v) => Ok((k, v)), + Err(e) => Err(e), + }) + .collect::>()?; // Determine the topological ordering of the packages. let pkgs = {