Created
July 3, 2012 05:15
-
-
Save andydude/3037825 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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