summaryrefslogtreecommitdiffhomepage
path: root/src/try/try.go
blob: d2ea27e5d47ca89dca65d64836d9158e6966977c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
package try

import (
	"log"

	"git.thomasvoss.com/euro-cash.eu/src/atexit"
)

func Try(e error) {
	if e != nil {
		atexit.Exec()
		log.Fatalln(e)
	}
}

func Try2[T any](x T, e error) T {
	Try(e)
	return x
}