- The one and only crash proofing mechanics for your Go app.
- Catches crashes/panics deep into your concurrent code
- What's the catch: DON'T use
go func(){}()
, usecrashproof.Go(func(){})
as in setup below
func main() {
crashproof.ConcurrentCodeCrashCatcher = reportCrash
crashproof.RunAppAndCatchCrashes(func() {
...
// YOUR CONCURRENT APP HERE
crashproof.Go(func(){
panic("OOPS")
})
...
})
}
func reportCrash(err interface{}, packageName string, callStack []crashproof.StackFrame) {
fmt.Fprintf(os.Stderr, "\n\nCRASH: %v\n\npackage %s\n\nstack: %v\n\n", err, packageName, callStack)
}