Skip to content

Commit

Permalink
Reduce nesting.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchell-as committed Nov 2, 2023
1 parent ae0395a commit e199e19
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/cmdlets/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,12 +85,15 @@ func (o *OutputError) MarshalOutput(f output.Format) interface{} {
func getErrorTips(err error) []string {
errorTips := []string{}
for _, err := range errs.Unpack(err) {
if v, ok := err.(ErrorTips); ok {
for _, tip := range v.ErrorTips() {
if !funk.Contains(errorTips, tip) {
errorTips = append(errorTips, tip)
}
v, ok := err.(ErrorTips)
if !ok {
continue
}
for _, tip := range v.ErrorTips() {
if funk.Contains(errorTips, tip) {
continue
}
errorTips = append(errorTips, tip)
}
}
return errorTips
Expand Down

0 comments on commit e199e19

Please sign in to comment.