errcoll

package
v0.0.0-...-b6e3791 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package errcoll contains implementations of error collectors, most notably Sentry.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Collectf

func Collectf(ctx context.Context, errColl Interface, format string, args ...any)

Collectf is a helper method for reporting non-critical errors. It writes the resulting error into the log and also into errColl.

Types

type ErrorFlushCollector

type ErrorFlushCollector interface {
	Interface

	// Flush waits until the underlying transport sends any buffered events to
	// the sentry server, blocking for at most the predefined timeout.
	Flush()
}

ErrorFlushCollector collects information about errors, possibly sending them to a remote location. The collected errors should be flushed with the Flush.

type Interface

type Interface interface {
	Collect(ctx context.Context, err error)
}

Interface is the interface for error collectors that process information about errors, possibly sending them to a remote location.

type SentryErrorCollector

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

SentryErrorCollector is an Interface implementation that sends errors to a Sentry-like HTTP API.

func NewSentryErrorCollector

func NewSentryErrorCollector(cli *sentry.Client) (c *SentryErrorCollector)

NewSentryErrorCollector returns a new SentryErrorCollector. cli must be non-nil.

func (*SentryErrorCollector) Collect

func (c *SentryErrorCollector) Collect(ctx context.Context, err error)

Collect implements the Interface interface for *SentryErrorCollector.

func (*SentryErrorCollector) Flush

func (c *SentryErrorCollector) Flush()

Flush implements the ErrorFlushCollector interface for *SentryErrorCollector.

type SentryReportableError

type SentryReportableError interface {
	error

	IsSentryReportable() (ok bool)
}

SentryReportableError is the interface for errors and wrapper that can tell whether they should be reported or not.

type WriterErrorCollector

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

WriterErrorCollector is an Interface implementation that writes errors to an io.Writer.

func NewWriterErrorCollector

func NewWriterErrorCollector(w io.Writer) (c *WriterErrorCollector)

NewWriterErrorCollector returns a new properly initialized *WriterErrorCollector.

func (*WriterErrorCollector) Collect

func (c *WriterErrorCollector) Collect(ctx context.Context, err error)

Collect implements the Interface interface for *WriterErrorCollector.

Jump to

Keyboard shortcuts

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