apierrors

package
v1.11.4-community Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write

func Write(w http.ResponseWriter, code int, err error)

func WriteStructured

func WriteStructured(w http.ResponseWriter, code int, httpErr StructuredError)

Types

type GenericError

type GenericError struct {
	StructuredError `json:"-"`
	Message         string `json:"message,omitempty"`
}

func (*GenericError) Error

func (e *GenericError) Error() string

func (*GenericError) Write

func (e *GenericError) Write(w http.ResponseWriter, code int)

type LokiClientError

type LokiClientError struct {
	StructuredError `json:"-"`
	LokiClient      bool   `json:"lokiClient,omitempty"`
	Message         string `json:"message,omitempty"`
}

LokiClientError is used when there is a client error while querying Loki, either on our side, or in the HTTP connection

func NewLokiClientError

func NewLokiClientError(err error) *LokiClientError

func (*LokiClientError) Error

func (e *LokiClientError) Error() string

func (*LokiClientError) Write

func (e *LokiClientError) Write(w http.ResponseWriter, code int)

type LokiDisabledError

type LokiDisabledError struct {
	StructuredError `json:"-"`
	LokiDisabled    bool   `json:"lokiDisabled,omitempty"`
	Message         string `json:"message,omitempty"`
}

func NewLokiDisabledError

func NewLokiDisabledError(message string) *LokiDisabledError

func (*LokiDisabledError) Error

func (e *LokiDisabledError) Error() string

func (*LokiDisabledError) Write

func (e *LokiDisabledError) Write(w http.ResponseWriter, code int)

type LokiResponseError

type LokiResponseError struct {
	StructuredError `json:"-"`
	LokiResponse    bool   `json:"lokiResponse,omitempty"`
	Message         string `json:"message,omitempty"`
}

func NewLokiResponseError

func NewLokiResponseError(code int, message string) *LokiResponseError

NewLokiResponseError is used when the HTTP call made it to Loki and returned an error

func (*LokiResponseError) Error

func (e *LokiResponseError) Error() string

func (*LokiResponseError) Write

func (e *LokiResponseError) Write(w http.ResponseWriter, code int)

type PromClientError

type PromClientError struct {
	StructuredError `json:"-"`
	PromClient      bool   `json:"promClient,omitempty"`
	Message         string `json:"message,omitempty"`
}

PromClientError is used when there is a client error while querying Prometheus, either on our side, or in the HTTP connection

func NewPromClientError

func NewPromClientError(err error) *PromClientError

func (*PromClientError) Error

func (e *PromClientError) Error() string

func (*PromClientError) Write

func (e *PromClientError) Write(w http.ResponseWriter, code int)

type PromDisabledError

type PromDisabledError struct {
	StructuredError `json:"-"`
	PromDisabled    bool   `json:"lokiDisabled,omitempty"`
	Message         string `json:"message,omitempty"`
}

func NewPromDisabledError

func NewPromDisabledError(message string) *PromDisabledError

func (*PromDisabledError) Error

func (e *PromDisabledError) Error() string

func (*PromDisabledError) Write

func (e *PromDisabledError) Write(w http.ResponseWriter, code int)

type PromDisabledMetricsError

type PromDisabledMetricsError struct {
	StructuredError     `json:"-"`
	PromDisabledMetrics bool     `json:"promDisabledMetrics,omitempty"`
	Candidates          []string `json:"candidates,omitempty"`
}

func NewPromDisabledMetrics

func NewPromDisabledMetrics(candidates []string) *PromDisabledMetricsError

func (*PromDisabledMetricsError) Error

func (e *PromDisabledMetricsError) Error() string

type PromMissingLabelsError

type PromMissingLabelsError struct {
	StructuredError   `json:"-"`
	PromMissingLabels bool                `json:"promMissingLabels,omitempty"`
	Missing           map[string][]string `json:"missing,omitempty"`
}

func NewPromMissingLabels

func NewPromMissingLabels(missing map[string][]string) *PromMissingLabelsError

func (*PromMissingLabelsError) Error

func (e *PromMissingLabelsError) Error() string

type PromUnsupportedError

type PromUnsupportedError struct {
	StructuredError `json:"-"`
	PromUnsupported bool   `json:"promUnsupported,omitempty"`
	Reason          string `json:"reason,omitempty"`
}

func NewPromUnsupported

func NewPromUnsupported(reason string) *PromUnsupportedError

func (*PromUnsupportedError) Error

func (e *PromUnsupportedError) Error() string

type StructuredError

type StructuredError interface {
	error
	Write(w http.ResponseWriter, code int)
}

Jump to

Keyboard shortcuts

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