knative / knative/pkg

apis.errs.Also does not propagate error level

Open
#2,514 8 comments 0 reactions 1 assignee Claimed by @JeromeJu View on GitHub
area/API kind/bug lifecycle/frozen
Dominant language
Go
Stars
276
Forks
343
Avg merge
1d 1h
Merged PRs (30d)
1

Description

/area API
/kind bug

## Steps to Reproduce the Problem
Using "warning" level error introduced in #2498:

```
func TestFoo(t *testing.T) {
var errs *apis.FieldError
errs = errs.Also(apis.FieldError("foo").At(apis.WarningLevel))
if errs.Level != apis.WarningLevel {
t.Errorf("Expected an error at warning level but got level %s", errs.Level)
}
}
```

## Expected Behavior

The aggregated error has the level that is the highest level of any errors combined with `Also`.
In the example above, I would expect `errs.Level` to be Warning, and `errs.Filter(apis.WarningLevel).Level` to also be Warning.

## Actual Behavior

In the example above, `errs.Level` and `errs.Filter(apis.WarningLevel).Level` are both Error. (i.e. an error at level "warning" aggregated with no error turns into an error at level "error")

@mattmoor

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.