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

Function GoWithRecover

IceFireDB-PubSub/utils/func.go:31–50  ·  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 log.Printf("%s goroutine panic: %v\n%s\n\n", time.Now().Format(time.DateTime), r, string(debug.Stack()))
36 if recoverHandler != nil {
37 go func() {
38 defer func() {
39 if p := recover(); p != nil {
40 log.Printf("recover goroutine panic:%v\n%s\n\n", p, string(debug.Stack()))
41 }
42 }()
43 recoverHandler(r)
44 }()
45 }
46 }
47 }()
48 handler()
49 }()
50}
51
52func GetInterfaceString(param any) string {
53 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