MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / GoWithRecover

Function GoWithRecover

IceFireDB-Redis-Proxy/utils/func.go:31–51  ·  view source on GitHub ↗
(handler func(), recoverHandler func(r any))

Source from the content-addressed store, hash-verified

29)
30
31func GoWithRecover(handler func(), recoverHandler func(r any)) {
32 go func() {
33 defer func() {
34 if r := recover(); r != nil {
35
36 log.Printf("%s goroutine panic: %v\n%s\n", time.Now().Format(time.DateTime), r, string(debug.Stack()))
37 if recoverHandler != nil {
38 go func() {
39 defer func() {
40 if p := recover(); p != nil {
41 log.Printf("recover goroutine panic:%v\n%s\n", p, string(debug.Stack()))
42 }
43 }()
44 recoverHandler(r)
45 }()
46 }
47 }
48 }()
49 handler()
50 }()
51}
52
53func GetInterfaceString(param any) string {
54 switch param := param.(type) {

Callers 3

subscribeFunction · 0.92
startFunction · 0.92
debugFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected