Documentation
¶
Index ¶
- func AppendStackTraceToPanics()
- func Catch(fn func()) (err error)
- func Close(closeable io.Closer, context ...any)
- func Default[T comparable](value T, defaultValue T) T
- func HandleErrors()
- func List[T any](values ...T) []T
- func Map[From, To any](values []From, mapFunc func(From) To) []To
- func Remove[T comparable](values []T, shouldRemove func(T) bool) []T
- func Return[T any](t T, e error) T
- func Return2[T1, T2 any](t1 T1, t2 T2, e error) (T1, T2)
- func Throw(e error)
- type OkError
- type StackTraceError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendStackTraceToPanics ¶
func AppendStackTraceToPanics()
func Catch ¶
func Catch(fn func()) (err error)
Catch handles panic values and returns any error caught
func Default ¶ added in v0.0.2
func Default[T comparable](value T, defaultValue T) T
Default returns the first value that does not equal the type's default value
func HandleErrors ¶
func HandleErrors()
HandleErrors is a utility to make errors and error codes handled prettier
func List ¶
func List[T any](values ...T) []T
List returns a slice containing all the provided values, removing any nil or "empty" values
func Map ¶
func Map[From, To any](values []From, mapFunc func(From) To) []To
Map returns a new slice with values mapped from incoming to outgoing in mapFunc
func Remove ¶
func Remove[T comparable](values []T, shouldRemove func(T) bool) []T
Remove returns a new slice with values removed based on true returns from shouldRemove
Types ¶
type StackTraceError ¶
StackTraceError provides nicer stack information
func NewStackTraceError ¶
func NewStackTraceError(err error) *StackTraceError
NewStackTraceError helps to capture nicer stack trace information
func (*StackTraceError) Error ¶
func (s *StackTraceError) Error() string
func (*StackTraceError) Unwrap ¶
func (s *StackTraceError) Unwrap() error
func (*StackTraceError) WithExitCode ¶
func (s *StackTraceError) WithExitCode(exitCode int) *StackTraceError
func (*StackTraceError) WithLog ¶
func (s *StackTraceError) WithLog(log string) *StackTraceError
Click to show internal directories.
Click to hide internal directories.