Skip to content

Commit

Permalink
Component error: apply 5cc0707 changes
Browse files Browse the repository at this point in the history
Apply 5cc0707 to component/componenterror.
  • Loading branch information
ozerovandrei committed Feb 14, 2021
1 parent b370f1c commit cc49843
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 97 deletions.
26 changes: 1 addition & 25 deletions component/componenterror/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ package componenterror

import (
"errors"
"fmt"
"strings"

"go.opentelemetry.io/collector/consumer/consumererror"
)
Expand All @@ -38,27 +36,5 @@ var (
// CombineErrors converts a list of errors into one error.
// Deprecated: use consumererror.CombineErrors instead.
func CombineErrors(errs []error) error {
numErrors := len(errs)
if numErrors == 0 {
// No errors
return nil
}

if numErrors == 1 {
return errs[0]
}

errMsgs := make([]string, 0, numErrors)
permanent := false
for _, err := range errs {
if !permanent && consumererror.IsPermanent(err) {
permanent = true
}
errMsgs = append(errMsgs, err.Error())
}
err := fmt.Errorf("[%s]", strings.Join(errMsgs, "; "))
if permanent {
err = consumererror.Permanent(err)
}
return err
return consumererror.CombineErrors(errs)
}
70 changes: 0 additions & 70 deletions component/componenterror/errors_test.go

This file was deleted.

2 changes: 0 additions & 2 deletions consumer/consumererror/combineerrors.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ import (
)

// CombineErrors converts a list of errors into one error.
//
// TODO: deprecate componenterror.CombineErrors in favor of this function.
func CombineErrors(errs []error) error {
numErrors := len(errs)
if numErrors == 0 {
Expand Down

0 comments on commit cc49843

Please sign in to comment.