Add recover

This commit is contained in:
2024-05-01 18:58:54 +05:30
parent f1fe463b05
commit 693eca244b
2 changed files with 23 additions and 2 deletions

19
recovering/recovering.go Normal file
View File

@@ -0,0 +1,19 @@
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")
}