1
0
mirror of https://github.com/open-telemetry/opentelemetry-go.git synced 2024-12-12 10:04:29 +02:00
This commit is contained in:
Tyler Yahn 2020-05-29 15:49:58 -07:00
parent 559606c419
commit ec6512f656
No known key found for this signature in database
GPG Key ID: 42AA23B0BC85B798
5 changed files with 8 additions and 6 deletions

View File

@ -20,6 +20,7 @@ import (
"time"
"github.com/stretchr/testify/suite"
"go.opentelemetry.io/otel/api/oterror"
)

View File

@ -22,6 +22,7 @@ import (
"go.opentelemetry.io/otel/api/kv"
"go.opentelemetry.io/otel/api/metric"
"go.opentelemetry.io/otel/api/oterror"
"go.opentelemetry.io/otel/api/unit"
mockTest "go.opentelemetry.io/otel/internal/metric"
@ -391,7 +392,7 @@ func TestWrappedInstrumentError(t *testing.T) {
valuerecorder, err := meter.NewInt64ValueRecorder("test.valuerecorder")
require.Equal(t, err, metric.ErrSDKReturnedNilImpl)
require.Equal(t, err, oterror.ErrSDKReturnedNilImpl)
require.NotNil(t, valuerecorder.SyncImpl())
observer, err := meter.NewInt64ValueObserver("test.observer", func(_ context.Context, result metric.Int64ObserverResult) {})

View File

@ -110,7 +110,7 @@ func (h syncBoundInstrument) Unbind() {
func checkNewAsync(instrument AsyncImpl, err error) (asyncInstrument, error) {
if instrument == nil {
if err == nil {
err = oterror.SDKReturnedNilImpl
err = oterror.ErrSDKReturnedNilImpl
}
instrument = NoopAsync{}
}
@ -125,7 +125,7 @@ func checkNewAsync(instrument AsyncImpl, err error) (asyncInstrument, error) {
func checkNewSync(instrument SyncImpl, err error) (syncInstrument, error) {
if instrument == nil {
if err == nil {
err = oterror.SDKReturnedNilImpl
err = oterror.ErrSDKReturnedNilImpl
}
// Note: an alternate behavior would be to synthesize a new name
// or group all duplicately-named instruments of a certain type

View File

@ -20,7 +20,7 @@
*
* The unified error handling interface is used for any error that
* OpenTelemetry component are not able to remediate on their own, instead
* handeling them in a uniform and user-defined way.
* handling them in a uniform and user-defined way.
*/
package oterror

View File

@ -17,6 +17,6 @@ package oterror
import "errors"
var (
// SDKReturnedNilImpl is returned when a new `MeterImpl` returns nil.
SDKReturnedNilImpl = errors.New("SDK returned a nil implementation")
// ErrSDKReturnedNilImpl is returned when a new `MeterImpl` returns nil.
ErrSDKReturnedNilImpl = errors.New("SDK returned a nil implementation")
)