Skip to content

Commit

Permalink
Log valid feature gates on error
Browse files Browse the repository at this point in the history
  • Loading branch information
djaglowski committed Sep 22, 2023
1 parent e116f8c commit ee9c339
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion featuregate/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ func (r *Registry) Register(id string, stage Stage, opts ...RegisterOption) (*Ga
func (r *Registry) Set(id string, enabled bool) error {
v, ok := r.gates.Load(id)
if !ok {
return fmt.Errorf("no such feature gate %q", id)
validGates := []string{}
r.VisitAll(func(g *Gate) {
validGates = append(validGates, g.ID())
})
return fmt.Errorf("no such feature gate %q. valid gates: %v", id, validGates)
}
g := v.(*Gate)

Expand Down

0 comments on commit ee9c339

Please sign in to comment.