func TestUnderlying(t *testing.T) {
	e1 := errors.New("")
	e2 := stackerr.Wrap(e1)
	errs := stackerr.Underlying(e2)
	if len(errs) != 2 || errs[0] != e2 || errs[1] != e1 {
		t.Fatal("failed Underlying")
	}
}
func TestWrap(t *testing.T) {
	const errStr = "foo bar baz"
	e := stackerr.Wrap(errors.New(errStr))
	matches := []string{
		errStr,
		"^github.com/facebookgo/stackerr/stackerr_test.go:36 +TestWrap$",
	}
	match(t, e.Error(), matches)
}
示例#3
0
func Wrap(err error) error {
	if util.Debug {
		return stackerr.Wrap(err)
	}
	return err
}