From 3f112b45f55d565a8a13fe72d07fb0953ecfed10 Mon Sep 17 00:00:00 2001 From: Eric Myhre Date: Wed, 29 Sep 2021 14:10:43 +0200 Subject: [PATCH] traversal: tweak phrasing of error message Co-authored-by: Peter Rabbitson --- traversal/fns.go | 2 +- traversal/walk_test.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/traversal/fns.go b/traversal/fns.go index 773a91d9..fe616daf 100644 --- a/traversal/fns.go +++ b/traversal/fns.go @@ -89,7 +89,7 @@ type ErrBudgetExceeded struct { } func (e *ErrBudgetExceeded) Error() string { - msg := fmt.Sprintf("traversal budget exceeded: budget for %ss reached zero as we reached path %q", e.BudgetKind, e.Path) + msg := fmt.Sprintf("traversal budget exceeded: budget for %ss reached zero while on path %q", e.BudgetKind, e.Path) if e.Link != nil { msg += fmt.Sprintf(" (link: %q)", e.Link) } diff --git a/traversal/walk_test.go b/traversal/walk_test.go index f68353ff..db456a55 100644 --- a/traversal/walk_test.go +++ b/traversal/walk_test.go @@ -284,7 +284,7 @@ func TestWalkBudgets(t *testing.T) { }) qt.Check(t, order, qt.Equals, 1) // because it should've stopped early qt.Assert(t, err, qt.Not(qt.Equals), nil) - qt.Check(t, err.Error(), qt.Equals, `traversal budget exceeded: budget for nodes reached zero as we reached path "bar"`) + qt.Check(t, err.Error(), qt.Equals, `traversal budget exceeded: budget for nodes reached zero while on path "bar"`) }) t.Run("link-budget-halts", func(t *testing.T) { ss := ssb.ExploreAll(ssb.Matcher()) @@ -319,6 +319,6 @@ func TestWalkBudgets(t *testing.T) { }) qt.Check(t, order, qt.Equals, 3) qt.Assert(t, err, qt.Not(qt.Equals), nil) - qt.Check(t, err.Error(), qt.Equals, `traversal budget exceeded: budget for links reached zero as we reached path "3" (link: "baguqeeyexkjwnfy")`) + qt.Check(t, err.Error(), qt.Equals, `traversal budget exceeded: budget for links reached zero while on path "3" (link: "baguqeeyexkjwnfy")`) }) }