gf/geg/other/try-catch.go
2019-06-03 20:58:30 +08:00

23 lines
349 B
Go

package main
import (
"github.com/gogf/gf/g"
"github.com/gogf/gf/g/os/glog"
)
func main() {
g.TryCatch(func() {
glog.Println("hello")
g.Throw("exception")
glog.Println("world")
})
g.TryCatch(func() {
glog.Println("hello")
g.Throw("exception")
glog.Println("world")
}, func(exception interface{}) {
glog.Error(exception)
})
}