Skip to content

Commit 1f8e7e2

Browse files
authored
Print available worlds in the “multiple worlds” error message (#1654)
1 parent b92dd79 commit 1f8e7e2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

crates/wit-parser/src/resolve.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1021,8 +1021,9 @@ impl Resolve {
10211021
0 => bail!("no worlds found in package `{}`", pkg.name),
10221022
1 => return Ok(*pkg.worlds.values().next().unwrap()),
10231023
_ => bail!(
1024-
"multiple worlds found in package `{}`: one must be explicitly chosen",
1025-
pkg.name
1024+
"multiple worlds found in package `{}`, one must be explicitly chosen:{}",
1025+
pkg.name,
1026+
pkg.worlds.keys().map(|name| format!("\n {name}")).collect::<String>()
10261027
),
10271028
}
10281029
}

0 commit comments

Comments
 (0)