diff options
author | Pratyush Desai | 2024-10-12 20:05:22 +0200 |
---|---|---|
committer | Pratyush Desai | 2024-10-12 20:05:22 +0200 |
commit | 67ef6fec1b6b4ca6b99701109b15f60a853dc5a2 (patch) | |
tree | e4a9814487f76716c063511ff5379c3647a05463 /wat/utils.go | |
parent | 91b0e21b7ac29d11d7c6774c92c99f4640a1a8d1 (diff) | |
parent | 930839ab58a60a5e3026de6f8a659fdcd8c25173 (diff) | |
download | watbot-67ef6fec1b6b4ca6b99701109b15f60a853dc5a2.tar.gz watbot-67ef6fec1b6b4ca6b99701109b15f60a853dc5a2.tar.bz2 watbot-67ef6fec1b6b4ca6b99701109b15f60a853dc5a2.zip |
Reviewed-on: https://git.com.de/LibertaCasa/watbot/pulls/27
Diffstat (limited to 'wat/utils.go')
-rw-r--r-- | wat/utils.go | 22 |
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 "" +} |