Skip to content

Commit

Permalink
traversal: tweak phrasing of error message
Browse files Browse the repository at this point in the history
Co-authored-by: Peter Rabbitson <ribasushi@protocol.ai>
  • Loading branch information
warpfork and ribasushi committed Sep 29, 2021
1 parent ed05188 commit 3f112b4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion traversal/fns.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
4 changes: 2 additions & 2 deletions traversal/walk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down Expand Up @@ -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")`)
})
}

0 comments on commit 3f112b4

Please sign in to comment.