serr

package module
v0.0.0-...-ebc3d4b Latest Latest
Warning

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

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

README

go-serr

Structured Error Handling for Golang

Documentation

Index

Constants

View Source
const (
	ExcerptFormat      = "%s%s%s"
	LengthPrefixFormat = "[len=%d] %s"
	EllipsisRune       = "\u2026"
)

Variables

This section is empty.

Functions

func As

func As(err error, sErr SError)

func Diff

func Diff(s1, s2 string, n int) (_, _ string, start, end int)

func Excerpt

func Excerpt(s string, width int) string

func ExcerptWithLen

func ExcerptWithLen(s string, width int) string

func Is

func Is(err, sErr error) bool

Types

type SError

type SError interface {
	error
	GetArgs() []any
	Args(...any) SError
	Attrs() []slog.Attr
	Attr(string) (slog.Attr, bool)
	Err(error, ...any) SError
	Unwrap() error
	ValidArgs(...string) SError
	NoArgs() SError
	String() string
	IsNil() bool
	Clone() SError
	CloneWrap() SError
	CloneUnwrap() error
}

func Cast

func Cast(err error, args ...any) SError

func New

func New(msg string) SError

func Wrap

func Wrap(err error, msg string, args ...any) SError

Jump to

Keyboard shortcuts

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