Skip to content

Commit

Permalink
Set/Delete props unified errors output (#823)
Browse files Browse the repository at this point in the history
  • Loading branch information
talarian1 committed Sep 9, 2020
1 parent 8611088 commit 8478648
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions artifactory/commands/generic/deleteprops.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ func (deleteProps *DeletePropsCommand) Run() error {
if err != nil {
return err
}
reader, searchErr := searchItems(deleteProps.Spec(), servicesManager)
if searchErr != nil {
return searchErr
reader, err := searchItems(deleteProps.Spec(), servicesManager)
if err != nil {
return err
}
defer reader.Close()
propsParams := GetPropsParams(reader, deleteProps.props)
success, err := servicesManager.DeleteProps(propsParams)
result := deleteProps.Result()
result.SetSuccessCount(success)
totalLength, totalLengthErr := reader.Length()
result.SetFailCount(totalLength - success)
if totalLengthErr != nil {
return totalLengthErr
}
result.SetFailCount(totalLength - success)
return err
}
8 changes: 4 additions & 4 deletions artifactory/commands/generic/setprops.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ func (setProps *SetPropsCommand) Run() error {
return err
}

reader, searchErr := searchItems(setProps.Spec(), servicesManager)
reader, err := searchItems(setProps.Spec(), servicesManager)
if err != nil {
return err
}
defer reader.Close()
propsParams := GetPropsParams(reader, setProps.props)
success, err := servicesManager.SetProps(propsParams)
Expand All @@ -40,9 +43,6 @@ func (setProps *SetPropsCommand) Run() error {
result.SetSuccessCount(success)
totalLength, totalLengthErr := reader.Length()
result.SetFailCount(totalLength - success)
if err == nil {
return searchErr
}
if totalLengthErr != nil {
return totalLengthErr
}
Expand Down

0 comments on commit 8478648

Please sign in to comment.