Skip to content

Commit

Permalink
modify error message when transaction not found in numbered pool
Browse files Browse the repository at this point in the history
Signed-off-by: Harshit Gangal <[email protected]>
  • Loading branch information
harshit-gangal committed Apr 19, 2024
1 parent ff6ca02 commit 8acec63
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion go/pools/numbered.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ func (nu *Numbered) Get(id int64, purpose string) (val any, err error) {
if unreg, ok := nu.recentlyUnregistered.Get(fmt.Sprintf("%v", id)); ok {
return nil, fmt.Errorf("ended at %v (%v)", unreg.timeUnregistered.Format("2006-01-02 15:04:05.000 MST"), unreg.reason)
}
return nil, fmt.Errorf("not found")
return nil, fmt.Errorf("not found (potential transaction timeout)")
}
if nw.inUse {
return nil, fmt.Errorf("in use: %s", nw.purpose)
Expand Down
2 changes: 1 addition & 1 deletion go/pools/numbered_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func TestNumberedGeneral(t *testing.T) {

p.Put(id)
_, err = p.Get(1, "test2")
assert.Contains(t, "not found", err.Error())
assert.ErrorContains(t, err, "not found (potential transaction timeout)")
p.Unregister(1, "test") // Should not fail
p.Unregister(0, "test")
// p is now empty
Expand Down

0 comments on commit 8acec63

Please sign in to comment.