Skip to content

Instantly share code, notes, and snippets.

@andydude
Created July 3, 2012 05:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andydude/3037825 to your computer and use it in GitHub Desktop.
Save andydude/3037825 to your computer and use it in GitHub Desktop.
func error1panic(err error) {
if err != nil {
panic(err)
}
return
}
func error2panic(a Any, err error) Any {
if err != nil {
panic(err)
}
return a
}
func panic1error() (err error) {
x := recover()
if x != nil {
debug.PrintStack()
err = ToError(x)
fmt.Printf("ERROR: %s\n", err)
}
return nil
}
func panic2error(a Any) (c Any, err error) {
x := recover()
if x != nil {
debug.PrintStack()
c = a
err = ToError(x)
fmt.Printf("ERROR: %s\n", err)
}
return a, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment