<commit_before>package grip

import (
	"errors"
	"strings"
)

// Provides an interface to collect and coalesse error messages within
// a function or other sequence of operations. Used to implement a kind
// of "continue on error"-style operations

type MultiCatcher struct {
	errs []string
}

func NewCatcher() *MultiCatcher {
	return &MultiCatcher{}
}

func (self *MultiCatcher) Add(err error) {
	if err != nil {
		self.errs = append(self.errs, err.Error())
	}
}

func (self *MultiCatcher) Len() int {
	return len(self.errs)
}

func (self *MultiCatcher) HasErrors() bool {
	if self.Len() == 0 {
		return false
	} else {
		return true
	}
}

func (self *MultiCatcher) String() string {
	return strings.Join(self.errs, ", ")
}

func (self *MultiCatcher) Resolve() (err error) {
	if self.count == 0 {
		err = nil
	} else if self.count == 1 {
		err = errors.New(self.errs[0])
	} else {
		err = errors.New(self.String())
	}

	self = NewCatcher()
	return err
}<commit_msg>remove count references<commit_after>package grip

import (
	"errors"
	"strings"
)

// Provides an interface to collect and coalesse error messages within
// a function or other sequence of operations. Used to implement a kind
// of "continue on error"-style operations

type MultiCatcher struct {
	errs []string
}

func NewCatcher() *MultiCatcher {
	return &MultiCatcher{}
}

func (self *MultiCatcher) Add(err error) {
	if err != nil {
		self.errs = append(self.errs, err.Error())
	}
}

func (self *MultiCatcher) Len() int {
	return len(self.errs)
}

func (self *MultiCatcher) HasErrors() bool {
	if self.Len() == 0 {
		return false
	} else {
		return true
	}
}

func (self *MultiCatcher) String() string {
	return strings.Join(self.errs, ", ")
}

func (self *MultiCatcher) Resolve() (err error) {
	if self.Len() == 0 {
		err = nil
	} else if self.Len() == 1 {
		err = errors.New(self.errs[0])
	} else {
		err = errors.New(self.String())
	}

	self = NewCatcher()
	return err
}
{'fraction_non_alphanumeric': 0.1368312757201646, 'fraction_numerical': 0.00411522633744856, 'mean_word_length': 3.709443099273608, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4563420', 'n_tokens_mistral': 731, 'n_tokens_neox': 685, 'n_words': 210}