diff --git a/api/global/handler_test.go b/api/global/handler_test.go index d1c96dafc..e1d8c4c1f 100644 --- a/api/global/handler_test.go +++ b/api/global/handler_test.go @@ -20,6 +20,7 @@ import ( "time" "github.com/stretchr/testify/suite" + "go.opentelemetry.io/otel/api/oterror" ) diff --git a/api/metric/api_test.go b/api/metric/api_test.go index ebe21b4b9..ca7027882 100644 --- a/api/metric/api_test.go +++ b/api/metric/api_test.go @@ -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) {}) diff --git a/api/metric/sync.go b/api/metric/sync.go index 2cdc9fb14..46d8fa02c 100644 --- a/api/metric/sync.go +++ b/api/metric/sync.go @@ -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 diff --git a/api/oterror/doc.go b/api/oterror/doc.go index aa2f59d0e..9d4b5f775 100644 --- a/api/oterror/doc.go +++ b/api/oterror/doc.go @@ -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 diff --git a/api/oterror/errors.go b/api/oterror/errors.go index 2dfb1f083..068894253 100644 --- a/api/oterror/errors.go +++ b/api/oterror/errors.go @@ -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") )