mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-15 10:50:18 +00:00
5a66991bb3
updating the kubernetes release to the latest in main go.mod Signed-off-by: Madhu Rajanna <madhupr007@gmail.com>
37 lines
794 B
Go
37 lines
794 B
Go
// Copyright The OpenTelemetry Authors
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
package global // import "go.opentelemetry.io/otel/internal/global"
|
|
|
|
import (
|
|
"log"
|
|
"sync/atomic"
|
|
)
|
|
|
|
// ErrorHandler handles irremediable events.
|
|
type ErrorHandler interface {
|
|
// Handle handles any error deemed irremediable by an OpenTelemetry
|
|
// component.
|
|
Handle(error)
|
|
}
|
|
|
|
type ErrDelegator struct {
|
|
delegate atomic.Pointer[ErrorHandler]
|
|
}
|
|
|
|
// Compile-time check that delegator implements ErrorHandler.
|
|
var _ ErrorHandler = (*ErrDelegator)(nil)
|
|
|
|
func (d *ErrDelegator) Handle(err error) {
|
|
if eh := d.delegate.Load(); eh != nil {
|
|
(*eh).Handle(err)
|
|
return
|
|
}
|
|
log.Print(err)
|
|
}
|
|
|
|
// setDelegate sets the ErrorHandler delegate.
|
|
func (d *ErrDelegator) setDelegate(eh ErrorHandler) {
|
|
d.delegate.Store(&eh)
|
|
}
|