package fault import ( "context" "errors" "testing" ) func TestInternalCausePreservesClassification(t *testing.T) { cause := errors.Join(context.Canceled, errors.New("private-database-password")) err := New(900001, "open connection failed", cause) if !errors.Is(err, context.Canceled) || !Internal(err) || err.Code() != 900001 { t.Fatal("cause or classification lost") } if err.Error() != "open connection failed" { t.Fatal("private text leaked") } }