You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: filtererrors.go
    path of file: ./repos/blocky/lists/parsers
    
    the code of the file until where you have to start completion: package parsers

import (
	"context"
	"errors"
)

// NoErrorLimit can be used to continue parsing until EOF.
const NoErrorLimit = -1

var ErrTooManyErrors = errors.New("too many parse errors")

type FilteredSeriesParser[T any] interface {
	SeriesParser[T]

	// OnErr registers a callback invoked for each error
    
func (f *errorFilter[T]) Next(ctx context.Context) (T, error) {
	var zero T

	for {
		res, err := f.inner.Next(ctx)
		if err != nil {
			if IsNonResumableErr(err) {
				// bypass the filter, and just propagate the error
				return zero, err
			}

			err = f.filter(err)
			if err != nil {
				return zero, err
			}

			continue
		}

		return res, nil
	}
}