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