This test demonstrates that a barrier hides it causes.
(t *testing.T)
| 30 | |
| 31 | // This test demonstrates that a barrier hides it causes. |
| 32 | func 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. |