Skip to content

Commit 8692cfc

Browse files
committed
improve unexpected error panic path
Signed-off-by: Tim Ramlot <42113979+inteon@users.noreply.github.com>
1 parent 298dfbc commit 8692cfc

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

pkg/datagatherer/k8sdynamic/dynamic.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,8 @@ func (c *ConfigDynamic) newDataGathererWithClient(ctx context.Context, cl dynami
233233
for _, labelSelectorString := range c.LabelSelectors {
234234
selector, err := labels.Parse(labelSelectorString)
235235
if err != nil {
236-
// This should never happen since validation already passed
237-
log.Error(err, "failed to parse validated label selector", "selector", labelSelectorString)
238-
panic(fmt.Sprintf("failed to parse validated label selector %q: %v", labelSelectorString, err))
236+
panic(fmt.Sprintf("PROGRAMMING ERROR: should have been caught in validation: "+
237+
"failed to parse validated label selector %q: %v", labelSelectorString, err))
239238
}
240239
reqs, _ := selector.Requirements()
241240
labelSelector = labelSelector.Add(reqs...)

0 commit comments

Comments
 (0)