From eab9ef8e66dc0c8efa9be3fa38a7b6f8dff90be0 Mon Sep 17 00:00:00 2001 From: Chris Roberts Date: Wed, 28 Sep 2022 08:37:20 -0700 Subject: [PATCH] Box find should return nil on not found --- internal/server/singleprocess/state/box.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/server/singleprocess/state/box.go b/internal/server/singleprocess/state/box.go index 697d0bc7e..a01516167 100644 --- a/internal/server/singleprocess/state/box.go +++ b/internal/server/singleprocess/state/box.go @@ -318,12 +318,15 @@ func (s *State) BoxFind( }, ) if result.Error != nil { + if errors.Is(result.Error, gorm.ErrRecordNotFound) { + return nil, nil + } return nil, lookupErrorToStatus("box", result.Error) } // If we found no boxes, return a not found error if len(boxes) < 1 { - return nil, lookupErrorToStatus("box", gorm.ErrRecordNotFound) + return nil, nil // lookupErrorToStatus("box", gorm.ErrRecordNotFound) } // If we have no version value set, apply the default