Skip to content

Commit e9f032a

Browse files
authored
Merge pull request #171 from pulp-platform/michaero/fix_dep_mismatch_panic
Fix dependency mismatch panic
2 parents 7fa835c + eebfae7 commit e9f032a

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/sess.rs

+19-2
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,25 @@ impl<'sess, 'ctx: 'sess> Session<'ctx> {
179179
// Translate the name-based graph into an ID-based graph.
180180
let graph: IndexMap<DependencyRef, IndexSet<DependencyRef>> = graph_names
181181
.into_iter()
182-
.map(|(k, v)| (k, v.iter().map(|name| names[name]).collect()))
183-
.collect();
182+
.map(|(k, v)| {
183+
(
184+
k,
185+
v.iter()
186+
.map(|name| match names.get(name) {
187+
Some(id) => Ok(*id),
188+
None => Err(Error::new(format!(
189+
"Failed to match dependency {}, please run `bender update`!",
190+
name
191+
))),
192+
})
193+
.collect::<Result<_>>(),
194+
)
195+
})
196+
.map(|(k, v)| match v {
197+
Ok(v) => Ok((k, v)),
198+
Err(e) => Err(e),
199+
})
200+
.collect::<Result<_>>()?;
184201

185202
// Determine the topological ordering of the packages.
186203
let pkgs = {

0 commit comments

Comments
 (0)