errors

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: Apache-2.0 Imports: 11 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func As

func As(err error, target interface{}) bool

func Errorf

func Errorf(format string, args ...interface{}) error

func Is

func Is(err, target error) bool

func Join

func Join(errs ...error) error

func New

func New(message string, attrs ...ErrorAttribute) error

func Report

func Report(ctx context.Context, err error)

func ReportWithSeverity

func ReportWithSeverity(ctx context.Context, err error, severity Severity)

func SlogErr

func SlogErr(err error) slog.Attr

func Wrap

func Wrap(err error, attrs ...ErrorAttribute) error

func WrapStackf

func WrapStackf(err error, format string, args ...interface{}) error

func WrapWithStack

func WrapWithStack(err error, stackattr ErrorAttribute, attrs ...ErrorAttribute) error

Types

type AttributeType

type AttributeType uint8
const (
	UnknownAttributeType AttributeType = iota
	StringAttributeType
	Uint64AttributeType
	Int64AttributeType
	StackAttributeType
	StringPtrAttributeType
	NoOpStackAttributeType
)

type ErrorAttribute

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

func Int

func Int(key string, value int) ErrorAttribute

func Int64

func Int64(key string, value int64) ErrorAttribute

func KeyedStackf

func KeyedStackf(key, format string, args ...interface{}) ErrorAttribute

func Stackf

func Stackf(format string, args ...interface{}) ErrorAttribute

func String

func String(key, value string) ErrorAttribute

func StringPtr

func StringPtr(key string, value *string) ErrorAttribute

func Stringf

func Stringf(key, format string, args ...interface{}) ErrorAttribute

func Uint64

func Uint64(key string, value uint64) ErrorAttribute

type ErrorAttributes

type ErrorAttributes []ErrorAttribute

func (ErrorAttributes) ErrorAttributes

func (attrs ErrorAttributes) ErrorAttributes() map[string]interface{}

func (ErrorAttributes) SlogAttrs

func (attrs ErrorAttributes) SlogAttrs() []slog.Attr

type ErrorMessage

type ErrorMessage string

func (ErrorMessage) Error

func (e ErrorMessage) Error() string

type Severity

type Severity string
const (
	SeverityWarning Severity = "Warning"
	SeverityError   Severity = "Error"
)

func (Severity) String

func (s Severity) String() string

type WrapConfig

type WrapConfig struct {
	Error      error
	Stack      ErrorAttribute
	Attributes []ErrorAttribute
}

Jump to

Keyboard shortcuts

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