1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2025-11-29 23:07:45 +02:00

Do not wrap error if multierror does not have one. (#3772)

This commit is contained in:
Aaron Clawson
2023-02-27 09:10:55 -06:00
committed by GitHub
parent 01bbea3285
commit 17e5d0f549
2 changed files with 4 additions and 0 deletions

View File

@@ -551,6 +551,9 @@ func (m *multierror) errorOrNil() error {
if len(m.errors) == 0 {
return nil
}
if m.wrapped == nil {
return errors.New(strings.Join(m.errors, "; "))
}
return fmt.Errorf("%w: %s", m.wrapped, strings.Join(m.errors, "; "))
}