From 6ea98aedeed38f78ff1cd64c349e3c00b3399fec Mon Sep 17 00:00:00 2001 From: Jakub Novak Date: Fri, 20 Dec 2024 18:44:29 +0100 Subject: [PATCH] Fix is not found error --- packages/shared/pkg/db/snapshot.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/shared/pkg/db/snapshot.go b/packages/shared/pkg/db/snapshot.go index 10d6cd08b..52aa1263c 100644 --- a/packages/shared/pkg/db/snapshot.go +++ b/packages/shared/pkg/db/snapshot.go @@ -130,9 +130,13 @@ func (db *DB) GetLastSnapshot(ctx context.Context, sandboxID string, teamID uuid notFound := models.IsNotFound(err) - if err != nil && !notFound { + if err != nil { return nil, nil, fmt.Errorf("failed to get snapshot build for '%s': %w", sandboxID, err) } + if notFound { + return nil, nil, fmt.Errorf("no snapshot build found for '%s'", sandboxID) + } + return e.Edges.Snapshots[0], e.Edges.Builds[0], nil }