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

Function GoWithRecover

IceFireDB-SQLite/utils/util.go:22–41  ·  view source on GitHub ↗
(handler func(), recoverHandler func(r any))

Source from the content-addressed store, hash-verified

20}
21
22func GoWithRecover(handler func(), recoverHandler func(r any)) {
23 go func() {
24 defer func() {
25 if r := recover(); r != nil {
26 logrus.Errorf("%s goroutine panic: %v\n%s\n", time.Now().Format(time.DateTime), r, string(debug.Stack()))
27 if recoverHandler != nil {
28 go func() {
29 defer func() {
30 if p := recover(); p != nil {
31 logrus.Errorf("recover goroutine panic:%v\n%s\n", p, string(debug.Stack()))
32 }
33 }()
34 recoverHandler(r)
35 }()
36 }
37 }
38 }()
39 handler()
40 }()
41}
42
43func GetString(d any) (string, error) {
44 switch v := d.(type) {

Callers 2

RunMethod · 0.92
asyncSQLFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected