2026-09-10 14:15:13: merge [main:14224c2de53289839839d51f5885722051e41349];
This commit is contained in:
1 parent
554123722d
commit
5cb3885330
2726 files changed
+779293
-2185
No files matched your search
+14
@@ -0,0 +1,14 @@
|
||||
package errd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// Wrap wraps err with fmt.Errorf if err is non nil.
|
||||
// Intended for use with defer and a named error return.
|
||||
// Inspired by https://github.com/golang/go/issues/32676.
|
||||
func Wrap(err *error, f string, v ...any) {
|
||||
if *err != nil {
|
||||
*err = fmt.Errorf(f+": %w", append(v, *err)...)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user