errors

package
v0.0.0-...-8d1786a Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: Apache-2.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorMeta

type ErrorMeta struct {
	UserID         *string
	Tags           map[string]string
	RelatedRequest *http.Request
}

ErrorMeta is any additional metadata to attach to the error

type ErrorReporter

type ErrorReporter interface {
	// Msg sends a message asynchronously
	Msg(msg string, meta *ErrorMeta)
	// Error sends an error type asynchronously
	Error(err error, meta *ErrorMeta)
}

ErrorReporter is an interface to the error reporting system Could by Stackdriver, could be Sentry

type MetaErrorReporter

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

MetaErrorReporter is an ErrorReporter that reports to multiple services. Reports to Stackdriver and Sentry

func NewMetaErrorReporter

func NewMetaErrorReporter(config *MetaErrorReporterConfig) (*MetaErrorReporter, error)

NewMetaErrorReporter returns a initialized MetaErrorReporter

func (*MetaErrorReporter) Error

func (m *MetaErrorReporter) Error(err error, meta *ErrorMeta)

Error sends an error type asynchronously

func (*MetaErrorReporter) Msg

func (m *MetaErrorReporter) Msg(msg string, meta *ErrorMeta)

Msg sends a message asynchronously

type MetaErrorReporterConfig

type MetaErrorReporterConfig struct {
	StackDriverProjectID      string
	StackDriverServiceName    string
	StackDriverServiceVersion string

	SentryDSN        string
	SentryRelease    string
	SentryLoggerName string
	SentryDebug      bool
	SentryEnv        string
	SentrySampleRate float32
}

MetaErrorReporterConfig configures the meta error reporting

type NullErrorReporter

type NullErrorReporter struct {
}

NullErrorReporter is a reporter that does nothing. Used for testing or if an "empty" reporter that logs to nowhere.

func (*NullErrorReporter) Error

func (n *NullErrorReporter) Error(err error, meta *ErrorMeta)

Error does nothing here

func (*NullErrorReporter) Msg

func (n *NullErrorReporter) Msg(msg string, meta *ErrorMeta)

Msg does nothing here

Jump to

Keyboard shortcuts

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