func (*functionSuite) TestWrapfOfNil(c *gc.C) { detailed := errors.New("detailed") err := errors.Wrapf(nil, detailed, "value %d", 42) //err nilWrapfTest c.Assert(err.Error(), gc.Equals, "value 42: detailed") c.Assert(errors.Cause(err), gc.Equals, detailed) c.Assert(errors.Details(err), jc.Contains, tagToLocation["nilWrapfTest"].String()) }
func (*functionSuite) TestWrapf(c *gc.C) { first := errors.New("first") //err wrapfFirst detailed := errors.New("detailed") err := errors.Wrapf(first, detailed, "value %d", 42) //err wrapfTest c.Assert(err.Error(), gc.Equals, "value 42: detailed") c.Assert(errors.Cause(err), gc.Equals, detailed) c.Assert(errors.Details(err), jc.Contains, tagToLocation["wrapfFirst"].String()) c.Assert(errors.Details(err), jc.Contains, tagToLocation["wrapfTest"].String()) }