Panic Recover
Python
- try:
- raise Exception('Shit')
- except Exception as e:
- print "error was:", e
Go
- package main
- import "fmt"
- func main() {
- // Running this will print out:
- // error was: Shit!
- defer func() {
- fmt.Println("error was:", recover())
- }()
- panic("Shit!")
- }