summaryrefslogtreecommitdiffstats
path: root/wat/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'wat/utils.go')
-rw-r--r--wat/utils.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/wat/utils.go b/wat/utils.go
new file mode 100644
index 0000000..331f7ad
--- /dev/null
+++ b/wat/utils.go
@@ -0,0 +1,22 @@
+package wat
+
+import (
+ "fmt"
+ "runtime"
+)
+
+func handleError(err error) string {
+ if err != nil {
+ pc, _, _, ok := runtime.Caller(1)
+ details := runtime.FuncForPC(pc)
+ var cFun string
+ if ok && details != nil {
+ cFun = details.Name()
+ } else {
+ cFun = "???"
+ }
+ fmt.Printf("caught error in %s: %v\n", cFun, err)
+ return "u wat"
+ }
+ return ""
+}