-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experiment with an errors.Join-based implementation
- Loading branch information
1 parent
85306c0
commit 2082dfe
Showing
5 changed files
with
146 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright The OpenTelemetry Authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package consumererror // import "go.opentelemetry.io/collector/consumer/consumererror" | ||
|
||
var noDataCount = -1 | ||
|
||
type Partial struct { | ||
err error | ||
count int | ||
} | ||
|
||
func NewPartial(err error, count int) error { | ||
return Partial{err: err, count: count} | ||
} | ||
|
||
func (p Partial) Error() string { | ||
return "Partial success: " + p.err.Error() | ||
} | ||
|
||
// Unwrap returns the wrapped error for functions Is and As in standard package errors. | ||
func (p Partial) Unwrap() error { | ||
return p.err | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.