Skip to content

Commit

Permalink
Use componenterror package errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Nick Fischer committed Jul 24, 2020
1 parent 88b71d1 commit 08abd1b
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions receiver/statsdreceiver/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package statsdreceiver

import (
"context"
"errors"
"sync"

"go.opentelemetry.io/collector/component"
Expand All @@ -28,12 +27,6 @@ import (
"github.com/open-telemetry/opentelemetry-collector-contrib/receiver/statsdreceiver/transport"
)

var (
errNilNextConsumer = errors.New("nil nextConsumer")
errAlreadyStarted = errors.New("already started")
errAlreadyStopped = errors.New("already stopped")
)

var _ component.MetricsReceiver = (*statsdReceiver)(nil)

// statsdReceiver implements the component.MetricsReceiver for StatsD protocol.
Expand All @@ -56,7 +49,7 @@ func New(
config Config,
nextConsumer consumer.MetricsConsumerOld) (component.MetricsReceiver, error) {
if nextConsumer == nil {
return nil, errNilNextConsumer
return nil, componenterror.ErrNilNextConsumer
}

if config.Endpoint == "" {
Expand Down Expand Up @@ -102,7 +95,7 @@ func (ddr *statsdReceiver) Shutdown(context.Context) error {
ddr.Lock()
defer ddr.Unlock()

var err = errAlreadyStopped
var err = componenterror.ErrAlreadyStopped
ddr.stopOnce.Do(func() {
err = ddr.server.Close()
})
Expand Down

0 comments on commit 08abd1b

Please sign in to comment.