mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-03-09 17:09:29 +00:00
Several packages are only used while running the e2e suite. These packages are less important to update, as the they can not influence the final executable that is part of the Ceph-CSI container-image. By moving these dependencies out of the main Ceph-CSI go.mod, it is easier to identify if a reported CVE affects Ceph-CSI, or only the testing (like most of the Kubernetes CVEs). Signed-off-by: Niels de Vos <ndevos@ibm.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)
|
|
}
|