errors

package
v1.0.16 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 30, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBadConfig                 = fmt.Errorf("bad config")
	ErrInvalidConfig             = fmt.Errorf("invalid config")
	ErrUninitializedConfig       = fmt.Errorf("unintialized config")
	ErrBadCerts                  = fmt.Errorf("bad certs")
	ErrCertAndKeyRequired        = fmt.Errorf("missing cert or key file when tls is enabled")
	ErrCertOrKeyFileMissing      = fmt.Errorf("either both tls cert path and tls key path should be provided or none")
	ErrCACertRequired            = fmt.Errorf("client-ca-cert-file must be provided")
	ErrBadTokenConfig            = fmt.Errorf("bad token configuration")
	ErrJwtMissing                = fmt.Errorf("missing jwt token")
	ErrJwtMissingKID             = fmt.Errorf("jwt token missing kid header")
	ErrJwtWrongKey               = fmt.Errorf("jwt key not found")
	ErrFetchingToken             = fmt.Errorf("error fetching token")
	ErrPermissionDenied          = fmt.Errorf("permission denied")
	ErrExceedMaxAllowedRetries   = fmt.Errorf("exceed max allowed retries")
	ErrFailedToFetchJWK          = fmt.Errorf("failed to fetch jwk")
	ErrEmptyEventsList           = fmt.Errorf("the events list is empty")
	ErrEventsSizeExceedsLimit    = fmt.Errorf("the total events size exceeds 1MB")
	ErrNegativeValue             = fmt.Errorf("the value must not be negative")
	ErrNonPositiveValue          = fmt.Errorf("the value must  be positive")
	ErrExceedMaxBufferSize       = fmt.Errorf("the size of the adding events exceeds max buffer size")
	ErrExceedMaxEventsListLength = fmt.Errorf("the size of the adding events exceeds max event list length")
	ErrEmptyCollectorID          = fmt.Errorf("invalid metering config, collector id can not be empty")
)

Functions

func HttpStatusCodeToGrpcCode

func HttpStatusCodeToGrpcCode(code int) codes.Code

HttpStatusCodeToGrpcCode takes an int of a httpStatus and returns the closest grpc code

Types

type ConfigError

type ConfigError struct {
	FieldName string
	Message   string
}

func (*ConfigError) Error

func (c *ConfigError) Error() string

type EncryptionError

type EncryptionError struct {
	Err     error  `json:"-"` // Actual error
	Message string `json:"message,omitempty"`
}

func ErrEncryptionFailed

func ErrEncryptionFailed(err error, reason string) *EncryptionError

func ErrEncryptionKeyNotFound

func ErrEncryptionKeyNotFound(keyId string) *EncryptionError

func ErrEncryptionKeySetMisconfigured

func ErrEncryptionKeySetMisconfigured(reason string) *EncryptionError

func (*EncryptionError) Equal

func (e *EncryptionError) Equal(err error) bool

func (*EncryptionError) Error

func (e *EncryptionError) Error() string

type Error

type Error interface {
	error

	WithCode(codes.Code) Error
	WithReason(string) Error
	WithOrigin(string) Error
	WithMetadata(md map[string]string) Error

	ID() string
	Origin() string
	Reason() string
	Metadata() map[string]string
	GetMetadata(key string) string
	GRPCStatus() *status.Status
}

func NewNVError

func NewNVError(err error) Error

type NVError

type NVError struct {
	nverrors.NVError
	// contains filtered or unexported fields
}

func (*NVError) Error

func (e *NVError) Error() string

func (*NVError) GRPCStatus

func (e *NVError) GRPCStatus() *status.Status

func (*NVError) GetMetadata

func (e *NVError) GetMetadata(key string) string

func (*NVError) ID

func (e *NVError) ID() string

func (*NVError) Metadata

func (e *NVError) Metadata() map[string]string

func (*NVError) Origin

func (e *NVError) Origin() string

func (*NVError) Reason

func (e *NVError) Reason() string

func (*NVError) WithCode

func (e *NVError) WithCode(code codes.Code) Error

func (*NVError) WithMetadata

func (e *NVError) WithMetadata(md map[string]string) Error

func (*NVError) WithOrigin

func (e *NVError) WithOrigin(origin string) Error

func (*NVError) WithReason

func (e *NVError) WithReason(reason string) Error

type NVErrorMarshaler

type NVErrorMarshaler struct {
	FallbackMarshaler runtime.Marshaler
}

NVErrorMarshaler implements runtime.Marshaler. It finds if the error is of type NVError and marshals it to NVError type rather than the standard grpc_status.Status type

func (*NVErrorMarshaler) ContentType

func (c *NVErrorMarshaler) ContentType(v interface{}) string

func (*NVErrorMarshaler) Marshal

func (c *NVErrorMarshaler) Marshal(v interface{}) ([]byte, error)

Marshal overrides the format for NVError. If it's not NVError type, it falls back to standard definition.

func (*NVErrorMarshaler) NewDecoder

func (c *NVErrorMarshaler) NewDecoder(r io.Reader) runtime.Decoder

func (*NVErrorMarshaler) NewEncoder

func (c *NVErrorMarshaler) NewEncoder(w io.Writer) runtime.Encoder

func (*NVErrorMarshaler) Unmarshal

func (c *NVErrorMarshaler) Unmarshal(data []byte, v interface{}) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL