gobyexample/recovering/recovering.go

20 lines
282 B
Go
Raw Normal View History

2024-05-01 13:28:54 +00:00
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")
}