diff options
-rw-r--r-- | misc/errors.go | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/misc/errors.go b/misc/errors.go index 5c22a20..8434637 100644 --- a/misc/errors.go +++ b/misc/errors.go @@ -5,3 +5,10 @@ import "fmt" func Wrap_one_error(a error, b error) error { return fmt.Errorf("%w: %w", a, b) } + +func First_or_panic[T any](v T, err error) T { + if err != nil { + panic(err) + } + return v +} |