chore: +Wrapf
This commit is contained in:
1 parent
0055c6aeec
commit
956d1fe823
1 file changed
+5
@@ -1,6 +1,7 @@
|
|||||||
package errors
|
package errors
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -12,6 +13,10 @@ func Wrap(err error, message string) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func Wrapf(err error, format string, args ...interface{}) error {
|
||||||
|
return Wrap(err, fmt.Sprintf(format, args...))
|
||||||
|
}
|
||||||
|
|
||||||
func Get[T *any](err error, field string) T {
|
func Get[T *any](err error, field string) T {
|
||||||
if err == nil {
|
if err == nil {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in new issue
Block a user