update add apis - process everything before return an error#86
update add apis - process everything before return an error#86yangcao77 merged 3 commits intodevfile:masterfrom
Conversation
Signed-off-by: Stephanie <[email protected]>
| @@ -51,15 +52,19 @@ func (d *DevfileV2) GetCommands(options common.DevfileOptions) ([]v1.Command, er | |||
| // AddCommands adds the slice of Command objects to the Devfile's commands | |||
| // if a command is already defined, error out | |||
There was a problem hiding this comment.
could you pls update the func desc for all the Add funcs, it errors out after processing everything
| errorsList = append(errorsList, (&common.FieldAlreadyExistError{Name: command.Id, Field: "command"}).Error()) | ||
| continue |
There was a problem hiding this comment.
IMO we should update teh test to see if all these ids are being returned in the err. Previously we didnt care as it was just return on first error. But since we are updating it for a specific purpose we should probably test it. We can use regex to match err strings like we do in devfile/api 🤔
Signed-off-by: Stephanie <[email protected]>
Signed-off-by: Stephanie <[email protected]>
964bbca to
25af2f1
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: maysunfaisal, yangcao77 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Signed-off-by: Stephanie [email protected]
What does this PR do?
This PR updates add apis to process everything before return an error.
The error returned is a total error which contains error of all invalid elements during that add action
What issues does this PR fix or reference?
Fixes devfile/api#449
Is your PR tested? Consider putting some instruction how to test your changes
update unit tests to check for error message