コード例 #1
0
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")
	}
}
コード例 #2
0
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
ファイル: debug.go プロジェクト: carriercomm/interplanetary
func Wrap(err error) error {
	if util.Debug {
		return stackerr.Wrap(err)
	}
	return err
}