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

feature request - add an error sub-type field for more precise error checking #10

Open
jmccormick2001 opened this issue Dec 3, 2019 · 4 comments

Comments

@jmccormick2001
Copy link

feature request...

if a user of this api wanted to specifically check a CSV for 'example annotations' it would be
nice to have a predefined sub-type for that specific validation check...

for example:

if err.Type == errors.CSVFileNotValid && err.SubType == errors.ExampleAnnotationsNotFound {
}

@estroz
Copy link
Member

estroz commented Dec 3, 2019

This is a somewhat complex feature to implement because errors.Error contains a predefined set of error types, to which we would have to add types for each field being validated, for all manifest types this library validates (ex. errors.ExampleAnnotationsNotFound for ClusterServiceVersions). That isn't a scalable approach.

However I agree we need to have some way to either check error types for field values or subdivide validators further.

/cc @njhale @kevinrizza

@joelanford
Copy link
Member

If we go down this path, would using Go 1.13's support for error wrapping and using errors.As() and/or errors.Is() help us?

@camilamacedo86
Copy link
Contributor

I think we can close this one as outdated.
See that if the annotation not be informed we ignore it.
Also, we added the check: #207 you can see an example of this called in SDK operator-framework/operator-sdk#5495.

@exdx @dinhxuanvu WDYT?

@exdx
Copy link
Member

exdx commented Feb 14, 2022

This is somewhat outdated specifically in regards to the annotation validation, considering the linked PR where validation was done to ensure the annotation is valid JSON. More so, as we move away from the CSV and moving the related annotations into a properties.yaml file this type of check would be less useful.

More broadly, the ask for more defined errors is useful though. Not sure if we should close just yet.

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

No branches or pull requests

5 participants