summaryrefslogtreecommitdiff
path: root/core/error.go
diff options
context:
space:
mode:
Diffstat (limited to 'core/error.go')
-rw-r--r--core/error.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/core/error.go b/core/error.go
new file mode 100644
index 0000000..7b1871a
--- /dev/null
+++ b/core/error.go
@@ -0,0 +1,16 @@
+package core
+
+import "fmt"
+
+func Wrap(err error, msg string) error {
+ return fmt.Errorf("%s: %w", msg, err)
+}
+
+func Expect(err error, msg string) {
+ if err != nil {
+ if msg != "" {
+ err = Wrap(err, msg)
+ }
+ panic(err)
+ }
+}