Skip to content

Commit 58ad4ff

Browse files
committed
show what ancestors were expected
1 parent 4b2f1cd commit 58ad4ff

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

pkg/mark/ancestry.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,15 @@ func ValidateAncestry(
109109
}
110110

111111
if len(page.Ancestors) < len(ancestry) {
112-
return nil, fmt.Errorf(
113-
"page %q has fewer parents than specified: %s",
114-
page.Title,
115-
strings.Join(ancestry, ` > `),
116-
)
112+
actual := []string{}
113+
for _, ancestor := range page.Ancestors {
114+
actual = append(actual, ancestor.Title)
115+
}
116+
117+
return nil, karma.Describe("title", page.Title).
118+
Describe("actual", strings.Join(actual, " > ")).
119+
Describe("expected", strings.Join(ancestry, ">")).
120+
Format(nil, "the page has fewer parents than expected")
117121
}
118122

119123
for _, parent := range ancestry[:len(ancestry)-1] {

0 commit comments

Comments
 (0)