errorsource

package
v0.188.3 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddDownstreamErrorToResponse

func AddDownstreamErrorToResponse(refID string, response *backend.QueryDataResponse, err error) *backend.QueryDataResponse

AddDownstreamErrorToResponse adds the error as downstream source to the response if the error already has a source, the existing source will be used

func AddErrorToResponse

func AddErrorToResponse(refID string, response *backend.QueryDataResponse, err error) *backend.QueryDataResponse

AddErrorToResponse adds the error to the response

func AddPluginErrorToResponse

func AddPluginErrorToResponse(refID string, response *backend.QueryDataResponse, err error) *backend.QueryDataResponse

AddPluginErrorToResponse adds the error as plugin error source to the response if the error already has a source, the existing source will be used

func DownstreamError

func DownstreamError(err error, override bool) error

DownstreamError will apply the source as downstream

func FromStatus

func FromStatus(status backend.Status) backend.ErrorSource

FromStatus returns error source from status

func Middleware

func Middleware(plugin string) httpclient.Middleware

Middleware captures error source metric

func PluginError

func PluginError(err error, override bool) error

PluginError will apply the source as plugin

func Response

func Response(err error) backend.DataResponse

Response returns an error DataResponse given status, source of the error and message.

func RoundTripper

func RoundTripper(_ httpclient.Options, next http.RoundTripper) http.RoundTripper

RoundTripper returns the error source

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error captures error source and implements the error interface

func New

func New(err error, source backend.ErrorSource, status backend.Status) Error

func SourceError

func SourceError(source backend.ErrorSource, err error, override bool) Error

SourceError returns an error with the source If source is already defined, it will return it, or you can override

func (Error) Error

func (r Error) Error() string

Error implements the interface

func (Error) Source

func (r Error) Source() backend.ErrorSource

Source provides the error source

func (Error) Unwrap

func (r Error) Unwrap() error

Unwrap implements the interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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