aboutsummaryrefslogtreecommitdiff
path: root/misc/errors.go
blob: 190f8ba30c04568c1380d2ffd302ddbe52a89dd2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14

package misc

import "fmt"

func WrapOneError(a error, b error) error {
	return fmt.Errorf("%w: %w", a, b)
}

func FirstOrPanic[T any](v T, err error) T {
	if err != nil {
		panic(err)
	}
	return v
}