Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return empty array instead of an error #218

Merged
merged 1 commit into from Oct 12, 2023
Merged

Conversation

tothszabi
Copy link
Contributor

There are valid cases when a project does not contain any accessible schemes. One such case is if you generate a new Cocoapods project with a newer Cocoapods version. So it is fine to return an empty array instead of throwing an error.

Later in the code path we already had a validation to make sure we have a scheme with the given name:

func (w Workspace) Scheme(name string) (*xcscheme.Scheme, string, error) {
schemesByContainer, err := w.Schemes()
if err != nil {
return nil, "", err
}
normName := norm.NFC.String(name)
for container, schemes := range schemesByContainer {
for _, scheme := range schemes {
if norm.NFC.String(scheme.Name) == normName {
return &scheme, container, nil
}
}
}
return nil, "", xcscheme.NotFoundError{Scheme: name, Container: w.Name}
}

@tothszabi tothszabi merged commit e23ed8a into v1 Oct 12, 2023
4 checks passed
@tothszabi tothszabi deleted the better-project-scheme-handling branch October 12, 2023 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants