wreck

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

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

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 3 Imported by: 2

README

wreck

Experimental slog-compatible error handling package for Go.

Documentation

Overview

Package wreck implements slog-compatible errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Value

func Value[T any](err error, key string) (T, bool)

Value extracts a single error attribute value.

Types

type Error

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

Error is an error with attributes.

func New

func New(msg string) *Error

New creates a new error.

func (*Error) Error

func (e *Error) Error() string

Error returns the internal error message.

func (*Error) Is

func (e *Error) Is(target error) bool

Is reports whether the error matches the base error.

func (*Error) LogValue

func (e *Error) LogValue() slog.Value

LogValue returns the error as a slog value.

func (*Error) Message

func (e *Error) Message() string

Message returns the public error message.

func (*Error) New

func (e *Error) New(msg string, errs ...error) *Error

New creates a new error from the base error.

func (*Error) Unwrap

func (e *Error) Unwrap() error

Unwrap returns the error cause.

func (*Error) With

func (e *Error) With(args ...any) *Error

With returns a clone of the error with the specified key-value pair attributes.

Jump to

Keyboard shortcuts

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