20 lines
282 B
Go
20 lines
282 B
Go
package recovering
|
|
|
|
import "fmt"
|
|
|
|
func Recover() {
|
|
defer func() {
|
|
if r := recover(); r != nil {
|
|
fmt.Printf("Whew. Recovered from panic %v\n", r)
|
|
}
|
|
}()
|
|
|
|
doPanic()
|
|
|
|
fmt.Printf("I'll never execute >...<")
|
|
}
|
|
|
|
func doPanic() {
|
|
panic("aaaaaaaaaaahhhhhhhhhh sjdnsjdnsdjnsd")
|
|
}
|