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

Function TestAdaptProtoErrors

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

Source from the content-addressed store, hash-verified

176}
177
178func TestAdaptProtoErrors(t *testing.T) {
179 // If an error type has a proto representation already,
180 // it will be preserved exactly.
181 origErr := &errorspb.TestError{}
182 t.Logf("start err: %# v", pretty.Formatter(origErr))
183
184 newErr := network(t, origErr)
185
186 tt := testutils.T{T: t}
187
188 // In any case, the library preserves the error message.
189 tt.CheckEqual(newErr.Error(), origErr.Error())
190
191 // Moreover, it preserves the entire structure.
192 tt.CheckDeepEqual(newErr, origErr)
193}
194
195func TestAdaptProtoErrorsWithWrapper(t *testing.T) {
196 // proto-native error types are preserved exactly

Callers

nothing calls this directly

Calls 5

CheckEqualMethod · 0.95
ErrorMethod · 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…