From aa602cde3c4ab7c71af34d24d8dc2bfdc20b07b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Rakic?= Date: Fri, 18 Jul 2025 11:55:18 +0000 Subject: [PATCH] improve duplicate table errors --- crates/rust-project-goals/src/goal.rs | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/crates/rust-project-goals/src/goal.rs b/crates/rust-project-goals/src/goal.rs index ab5787a3..af52901b 100644 --- a/crates/rust-project-goals/src/goal.rs +++ b/crates/rust-project-goals/src/goal.rs @@ -537,10 +537,20 @@ fn goal_plan( plan_items, })) } - _ => anyhow::bail!( - "multiple goal tables found in section `{}`", - section.title.render() - ), + thats_too_many => { + let mut table_error = Vec::new(); + for (idx, table) in section.tables.iter().enumerate() { + let header: Vec<_> = table.header.iter().map(|h| h.to_string()).collect(); + table_error.push(format!("{}: {:?}", idx + 1, header.join(", "))); + } + + anyhow::bail!( + "markdown parsing unexpectedly encountered multiple ({}) goal tables in section `{}`:\n{}", + thats_too_many, + section.title.render(), + table_error.join("\n"), + ) + } } }