Skip to content

Commit

Permalink
Fix dependency mismatch panic
Browse files Browse the repository at this point in the history
  • Loading branch information
micprog committed Aug 21, 2024
1 parent 7fa835c commit eebfae7
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/sess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,25 @@ impl<'sess, 'ctx: 'sess> Session<'ctx> {
// Translate the name-based graph into an ID-based graph.
let graph: IndexMap<DependencyRef, IndexSet<DependencyRef>> = 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::<Result<_>>(),
)
})
.map(|(k, v)| match v {
Ok(v) => Ok((k, v)),
Err(e) => Err(e),
})
.collect::<Result<_>>()?;

// Determine the topological ordering of the packages.
let pkgs = {
Expand Down

0 comments on commit eebfae7

Please sign in to comment.