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

Function TestHideCause

barriers/barriers_test.go:32–44  ·  view source on GitHub ↗

This test demonstrates that a barrier hides it causes.

(t *testing.T)

Source from the content-addressed store, hash-verified

30
31// This test demonstrates that a barrier hides it causes.
32func TestHideCause(t *testing.T) {
33 tt := testutils.T{T: t}
34
35 origErr := errors.New("hello")
36 err1 := errors.Wrap(origErr, "world")
37
38 // Assertion: without barriers, the cause can be identified.
39 tt.Assert(markers.Is(err1, origErr))
40
41 // This test: a barrier hides the cause.
42 err := barriers.Handled(err1)
43 tt.Check(!markers.Is(err, origErr))
44}
45
46// This test demonstrates how the message is preserved (or not) depending
47// on how the barrier is constructed.

Callers

nothing calls this directly

Calls 4

AssertMethod · 0.95
CheckMethod · 0.95
IsFunction · 0.92
HandledFunction · 0.92

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…