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

cosigned error validation messages could be improved #1607

Closed
mattmoor opened this issue Mar 15, 2022 · 1 comment · Fixed by #1618
Closed

cosigned error validation messages could be improved #1607

mattmoor opened this issue Mar 15, 2022 · 1 comment · Fixed by #1618
Assignees
Labels
bug Something isn't working

Comments

@mattmoor
Copy link
Member

Description

I see three places in the cosigned API validation logic that use ErrGeneric, which takes a variadic second argument for field names, here is one such place:

if len(spec.Images) == 0 {
errors = errors.Also(apis.ErrGeneric("At least one image should be defined").ViaField("images"))
}

The error from this shows up as:

At least one image should be defined:

With the .ViaField doing nothing because no fields were supplied to the ErrGeneric!

I think that all of the current ErrGeneric calls in this file should be changed to use apis.ErrMissingField, which will produce a better error message.

cc @vaikas @kkavitha @coyote240

@mattmoor mattmoor added the bug Something isn't working label Mar 15, 2022
@cpanato
Copy link
Member

cpanato commented Mar 15, 2022

i will work on this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants