Skip to content

Commit

Permalink
add err handling
Browse files Browse the repository at this point in the history
Signed-off-by: bupd <[email protected]>
  • Loading branch information
bupd committed Jul 3, 2024
1 parent 20bef9c commit 1e60c1c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion internal/store/in-memory-store.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,15 @@ func (s *inMemoryStore) Add(ctx context.Context, digest string, image string) er
}
}

// Add the image to the store
func (s *inMemoryStore) AddImage(ctx context.Context, image string) {
// Add the image to the store
if _, exists := s.images[image]; exists {
// Log a warning instead of returning an error
fmt.Printf(
"Warning: Image %s already exists in the store. Proceeding with the addition.\n",
image,
)
}
s.images[image] = ""
fmt.Printf("Added image: %s\n", image)
}
Expand Down

0 comments on commit 1e60c1c

Please sign in to comment.