MCPcopy Index your code
hub / github.com/cockroachdb/errors / TestAdaptProtoErrorsWithWrapper

Function TestAdaptProtoErrorsWithWrapper

errbase/adapters_test.go:195–211  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

193}
194
195func TestAdaptProtoErrorsWithWrapper(t *testing.T) {
196 // proto-native error types are preserved exactly
197 // together with their wrappers.
198 rErr := &errorspb.TestError{}
199 origErr := pkgErr.WithMessage(rErr, "hello roachpb")
200 t.Logf("start err: %# v", pretty.Formatter(origErr))
201
202 newErr := network(t, origErr)
203
204 tt := testutils.T{T: t}
205
206 // In any case, the library preserves the error message.
207 tt.CheckEqual(newErr.Error(), origErr.Error())
208
209 // Moreover, it preserves the entire structure.
210 tt.CheckDeepEqual(newErr, origErr)
211}
212
213func TestAdaptContextCanceled(t *testing.T) {
214 // context.DeadlineExceeded is preserved exactly.

Callers

nothing calls this directly

Calls 4

CheckEqualMethod · 0.95
CheckDeepEqualMethod · 0.95
networkFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…