fault

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package fault provides tools for error handling.

Index

Constants

This section is empty.

Variables

View Source
var ErrIndexOutOfRange = errors.New("index out of range")

ErrIndexOutOfRange indicates attempt to access index that is out of range.

View Source
var ErrIntegerOverflow = errors.New("integer overflow")

ErrIntegerOverflow indicates integer overflow.

View Source
var ErrInvalidArgument = errors.New("invalid argument")

ErrInvalidArgument indicates attempt to pass invalid argument to function.

View Source
var ErrInvalidUse = errors.New("invalid use")

ErrInvalidUse indicates attempt to call function in invalid way.

View Source
var ErrNilPointer = errors.New("nil pointer")

ErrNilPointer indicates attempt to use nil pointer when value is required.

Functions

func Recover

func Recover(f func()) (err error)

Recover calls given function and returns recovered error if there was panic, or nil otherwise.

func Recovered

func Recovered(v any) error

Recovered returns error represented by given panic recovery result, or nil if result is nil.

func Trace

func Trace(err error) error

Trace returns given error wrapped to attach calling goroutine's stack trace, or nil if error is nil.

Due to many various implementations of error handling in Golang ecosystem, it is strongly recommended to wrap only errors which format you know, because any other errors can already contain stack trace in one form or another. Also do not "rewrap" errors except if you really want to get multiple stack trace.

Types

This section is empty.

Jump to

Keyboard shortcuts

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