fix(reduceErrors): return error when given an empty list (#675)
See https://github.com/ooni/probe/issues/1985 for context. While there, ensure nextlite has 100% of coverage.
This commit is contained in:
parent
4d50dd6d54
commit
ce8ec5b391
5 changed files with 18 additions and 3 deletions
|
|
@ -9,6 +9,9 @@ import (
|
|||
// the original netx implementation and that we cannot remove
|
||||
// or change without thinking about the consequences.
|
||||
|
||||
// See https://github.com/ooni/probe/issues/1985
|
||||
var errReduceErrorsEmptyList = errors.New("bug: reduceErrors given an empty list")
|
||||
|
||||
// quirkReduceErrors finds a known error in a list of errors since
|
||||
// it's probably most relevant. If this error is not found, just
|
||||
// return the first error according to this reasoning:
|
||||
|
|
@ -31,7 +34,8 @@ import (
|
|||
// See TODO(https://github.com/ooni/probe/issues/1779).
|
||||
func quirkReduceErrors(errorslist []error) error {
|
||||
if len(errorslist) == 0 {
|
||||
return nil
|
||||
// See https://github.com/ooni/probe/issues/1985
|
||||
return errReduceErrorsEmptyList
|
||||
}
|
||||
for _, err := range errorslist {
|
||||
var wrapper *ErrWrapper
|
||||
|
|
|
|||
Loading…
Reference in a new issue