errors

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2022 License: MIT Imports: 0 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Capture

func Capture(rErr *error, fn func() error) func()

Capture is a wrapper function which can be used to capture errors from closing via a defer. An example:

func Example() (err error) {
    f, _ := os.Open(...)
    defer errors.Capture(&err, f.Close)()
    ...
    return

Doing this will result in the error from the f.Close() call being put in the error via a ptr, if the error is not nil

Types

This section is empty.

Jump to

Keyboard shortcuts

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