Исходники и презентации
This commit is contained in:
14
lessons/errors/replace_panic/main.go
Normal file
14
lessons/errors/replace_panic/main.go
Normal file
@ -0,0 +1,14 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
defer func() {
|
||||
fmt.Println("recovered:", recover())
|
||||
}()
|
||||
|
||||
defer panic(3) // replaced panic(3)
|
||||
defer panic(2) // replaced panic(3)
|
||||
defer panic(1) // replaced panic(3)
|
||||
panic(0)
|
||||
}
|
||||
Reference in New Issue
Block a user