Skip to content

codemodify/systemkit-crashproof

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Crash Proof Go Apps

What it offers

  • 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(){}(), use crashproof.Go(func(){}) as in setup below

Sample

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)
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages