package main
import (
"fmt"
)
func RE() {
defer func() {
err:= recover()
if err != nil{
fmt.Println(err)
}
}()
func() {
panic("fsdfsdf")
}()
}
func main() {
RE()
fmt.Println("fsdfs")
}
更多具体细节http://c.biancheng.net/view/64.html
2022-12-18 11:06:55
package main
import (
"fmt"
)
func RE() {
defer func() {
err:= recover()
if err != nil{
fmt.Println(err)
}
}()
func() {
panic("fsdfsdf")
}()
}
func main() {
RE()
fmt.Println("fsdfs")
}
更多具体细节http://c.biancheng.net/view/64.html