Skip to content

Commit d0b135e

Browse files
committed
key check
1 parent 4acfea8 commit d0b135e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

pkg/commands/purge/root.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,11 @@ func (c *RootCommand) purgeKey(serviceID string, out io.Writer) error {
169169
// As we are now using the bulk purge endpoint instead of the single purge by key,
170170
// 'Status' is no longer returned. To avoid a breaking change, we are emulating this
171171
// response by hardcoding 'Status: ok' to a successful resonses.
172-
text.Success(out, "Purged key: %s (soft: %t). Status: ok, ID: %s", c.key, c.soft, m[c.key])
172+
purgeID, ok := m[c.key]
173+
if !ok {
174+
return fmt.Errorf("no purge ID returned for key: %s", c.key)
175+
}
176+
text.Success(out, "Purged key: %s (soft: %t). Status: ok, ID: %s", c.key, c.soft, purgeID)
173177
return nil
174178
}
175179

0 commit comments

Comments
 (0)