Include available choices in unknown scope diagnostics
This commit is contained in:
@@ -118,7 +118,11 @@ func selectConfigScopes[C any](suite ConfigSuite[C], input configInput[C], opera
|
||||
} else {
|
||||
scope, ok := findConfigScope(suite.Scopes, input.Scope)
|
||||
if !ok {
|
||||
return nil, fmt.Errorf("unknown configuration scope %q", input.Scope)
|
||||
choices := make([]string, 0, len(suite.Scopes))
|
||||
for _, available := range orderedConfigScopes(suite.Scopes) {
|
||||
choices = append(choices, available.Name)
|
||||
}
|
||||
return nil, fmt.Errorf("unknown configuration scope %q (available: %s)", input.Scope, joinStrings(choices))
|
||||
}
|
||||
if !containsOperation(scope.Operations, operation) {
|
||||
return nil, unsupportedConfigOperation(scope, operation)
|
||||
|
||||
Reference in New Issue
Block a user