Skip to content

Commit cc49843

Browse files
committed
Component error: apply 5cc0707 changes
Apply 5cc0707 to component/componenterror.
1 parent b370f1c commit cc49843

File tree

3 files changed

+1
-97
lines changed

3 files changed

+1
-97
lines changed

component/componenterror/errors.go

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ package componenterror
1818

1919
import (
2020
"errors"
21-
"fmt"
22-
"strings"
2321

2422
"go.opentelemetry.io/collector/consumer/consumererror"
2523
)
@@ -38,27 +36,5 @@ var (
3836
// CombineErrors converts a list of errors into one error.
3937
// Deprecated: use consumererror.CombineErrors instead.
4038
func CombineErrors(errs []error) error {
41-
numErrors := len(errs)
42-
if numErrors == 0 {
43-
// No errors
44-
return nil
45-
}
46-
47-
if numErrors == 1 {
48-
return errs[0]
49-
}
50-
51-
errMsgs := make([]string, 0, numErrors)
52-
permanent := false
53-
for _, err := range errs {
54-
if !permanent && consumererror.IsPermanent(err) {
55-
permanent = true
56-
}
57-
errMsgs = append(errMsgs, err.Error())
58-
}
59-
err := fmt.Errorf("[%s]", strings.Join(errMsgs, "; "))
60-
if permanent {
61-
err = consumererror.Permanent(err)
62-
}
63-
return err
39+
return consumererror.CombineErrors(errs)
6440
}

component/componenterror/errors_test.go

Lines changed: 0 additions & 70 deletions
This file was deleted.

consumer/consumererror/combineerrors.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ import (
2020
)
2121

2222
// CombineErrors converts a list of errors into one error.
23-
//
24-
// TODO: deprecate componenterror.CombineErrors in favor of this function.
2523
func CombineErrors(errs []error) error {
2624
numErrors := len(errs)
2725
if numErrors == 0 {

0 commit comments

Comments
 (0)