source: code/trunk/vendor/nhooyr.io/websocket/internal/errd/wrap.go@ 822

Last change on this file since 822 was 822, checked in by yakumo.izuru, 22 months ago

Prefer immortal.run over runit and rc.d, use vendored modules
for convenience.

Signed-off-by: Izuru Yakumo <yakumo.izuru@…>

File size: 326 bytes
Line 
1package errd
2
3import (
4 "fmt"
5)
6
7// Wrap wraps err with fmt.Errorf if err is non nil.
8// Intended for use with defer and a named error return.
9// Inspired by https://github.com/golang/go/issues/32676.
10func Wrap(err *error, f string, v ...interface{}) {
11 if *err != nil {
12 *err = fmt.Errorf(f+": %w", append(v, *err)...)
13 }
14}
Note: See TracBrowser for help on using the repository browser.