ge

package module
v0.0.0-...-7f5c5d9 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2024 License: MIT Imports: 5 Imported by: 4

README

Go Errors

Go Vet Go Report Card Go Reference

To Do

  • trace
  • is and as for Err()

Documentation

Index

Constants

View Source
const UNREACHABLE = "UNREACHABLE"

Variables

View Source
var ErrAssertionFailed = errors.New("assertion failed")

Functions

func As

func As[T any](err error) (T, bool)

func Assert

func Assert(cond bool, errs ...error)

func Detail

func Detail(err error, details D) error

func Details

func Details(err error) iter.Seq2[string, any]

func ErrOf

func ErrOf(errorable any) error

func Is

func Is(err error, target error) bool

func Join

func Join(errs ...error) (err error)

func Must

func Must[T any](value T, err error) T

func New

func New[T comparable](value T) error

func Throw

func Throw(err error)

func Try

func Try(fn func()) (recovered any)

func Unwrap

func Unwrap(err error) error

func UnwrapAll

func UnwrapAll(err error) []error

func Wrap

func Wrap(newWrapperError, originalError error) error

Types

type D

type D map[string]any

func (D) String

func (d D) String() string

type Detailed

type Detailed interface {
	Details() iter.Seq2[string, any]
}

type Result

type Result[T any] struct {
	// contains filtered or unexported fields
}

func Err

func Err[T any](err error) Result[T]

func OK

func OK[T any](val T) Result[T]

func Res

func Res[T any](val T, err error) Result[T]

func (Result[T]) Err

func (r Result[T]) Err() error

func (Result[T]) Must

func (r Result[T]) Must(wraps ...error) T

func (Result[T]) OK

func (r Result[T]) OK() bool

func (Result[T]) Unwrap

func (r Result[T]) Unwrap() (T, error)

type UnwrapError

type UnwrapError interface {
	Unwrap() error
}

type UnwrapErrors

type UnwrapErrors interface {
	Unwrap() []error
}

Directories

Path Synopsis
plot module

Jump to

Keyboard shortcuts

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