display error output better
rogpeppe opened this issue · 1 comments
rogpeppe commented
Sample output:
quicktest.go:109:
error:
values are not equal
got:
&errgo.Err{
Message_: "",
Cause_: &errgo.Err{
Message_: "duplicate key",
Cause_: nil,
Underlying_: nil,
File: "/home/rog/src/go/pkg/mod/github.com/juju/simplekv@v0.0.0-20180621131638-ff82918775e5/kv.go",
Line: 20,
},
Underlying_: &errgo.Err{
Message_: "",
Cause_: &errgo.Err{(CYCLIC REFERENCE)},
Underlying_: &errgo.Err{
Message_: "key test-key already exists",
Cause_: &errgo.Err{(CYCLIC REFERENCE)},
Underlying_: nil,
File: "/home/rog/src/go/pkg/mod/github.com/juju/simplekv@v0.0.0-20180621131638-ff82918775e5/kv.go",
Line: 80,
},
File: "/home/rog/src/go/pkg/mod/github.com/juju/simplekv@v0.0.0-20180621131638-ff82918775e5/memsimplekv/keyvalue.go",
Line: 62,
},
File: "/home/rog/src/go/pkg/mod/github.com/juju/simplekv@v0.0.0-20180621131638-ff82918775e5/kv.go",
Line: 84,
}
want:
nil
sources:
keyvalue.go:71:
68 defer close()
69
70 err = simplekv.SetKeyOnce(ctx, kv, "test-key", []byte("test-value"), time.Time{})
71! c.Assert(err, qt.Equals, nil)
72
73 result, err := kv.Get(ctx, "test-key")
74 c.Assert(err, qt.Equals, nil)
That's a very long error message, and most of it isn't very useful. Perhaps consider formatting errors differently?