gobyexample/recovering/recovering.go
2024-05-01 18:58:54 +05:30

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")
}