gf/.example/errors/gerror/gerror3.go

24 lines
326 B
Go
Raw Normal View History

2019-07-13 14:24:44 +08:00
package main
import (
"errors"
"fmt"
2019-07-29 21:01:19 +08:00
"github.com/gogf/gf/errors/gerror"
2019-07-13 14:24:44 +08:00
)
func Error1() error {
2019-07-13 16:41:23 +08:00
return errors.New("test1")
2019-07-13 14:24:44 +08:00
}
func Error2() error {
2019-07-13 16:41:23 +08:00
return gerror.New("test2")
2019-07-13 14:24:44 +08:00
}
func main() {
err1 := Error1()
err2 := Error2()
fmt.Println("err1:\n", gerror.Stack(err1))
fmt.Println("err2:\n", gerror.Stack(err2))
}