summaryrefslogtreecommitdiffhomepage
path: root/pkg/try/try.go
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2025-06-14 00:45:04 +0200
committerThomas Voss <mail@thomasvoss.com> 2025-06-14 00:45:04 +0200
commitfe2bae01c6b14eef0e61cd4a6bd50e814de4bb58 (patch)
tree60fbda65d5fa3a9afc966bce51b6968e966baf4c /pkg/try/try.go
parent2d5ca3a6cd507ef29eb13b3a78232264a2817e81 (diff)
Move some packages to pkg/
Diffstat (limited to 'pkg/try/try.go')
-rw-r--r--pkg/try/try.go19
1 files changed, 19 insertions, 0 deletions
diff --git a/pkg/try/try.go b/pkg/try/try.go
new file mode 100644
index 0000000..2576dcd
--- /dev/null
+++ b/pkg/try/try.go
@@ -0,0 +1,19 @@
+package try
+
+import (
+ "log"
+
+ "git.thomasvoss.com/euro-cash.eu/pkg/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
+}