// Error of changeset, returns the first error if any.
343883
func (changeset *Changeset) Error() error {
	if changeset.errors != nil {
		return changeset.errors[0]
	}
	return nil
}
131039
func (changeset *Changeset) Fetch(field string) interface{} {
	if change, ok := changeset.changes[field]; ok {
		return change
	}

	return changeset.values[field]
}
630883
func (db *database) setError(err error) {
	db.tfu = nil

	db.ml.Lock()
	if db.err == nil {
		db.readyCh = make(chan struct{})
	}
	db.tfl, db.err, db.last = nil, err, time.Time{}
	db.ml.Unlock()
}
1335810
func Convert(data interface{}) *Changeset {
	ch := &Changeset{}
	ch.values = make(map[string]interface{})
	ch.changes, ch.types, _ = mapSchema(data)

	return ch
}
304015
func (m MultiError) Error() string {
	msgs := make([]string, len(m))
	for i, de := range m {
		msgs[i] = de.Error()
	}
	return strings.Join(msgs, "\n")
}
517486
func Error(t TestingT, err error, msgAndArgs ...interface{}) {
	if h, ok := t.(tHelper); ok {
		h.Helper()
	}
	if assert.Error(t, err, msgAndArgs...) {
		return
	}
	t.FailNow()
}
263394
func (re *RollbackError) Error() string {
	if re.RollbackErr == nil {
		return re.Err.Error()
	}
	return fmt.Sprintf("%s (also, while rolling back: %s)", re.Err, re.RollbackErr)
}
1250541
func (ec *ErrorCollection) Error() string {
	if ec.Formatter == nil {
		return ""
	}

	ec.lock.RLock()
	defer ec.lock.RUnlock()
	str := ""
	for i, err := range ec.Errors {
		if ec.Formatter != nil {
			ec.Formatter(i, err, &str)
		}
	}
	return str
}
115079
func ValidateInclusion(ch *Changeset, field string, values []interface{}, opts ...Option) {
	val, exist := ch.changes[field]
	if !exist {
		return
	}

	options := Options{
		message: ValidateInclusionErrorMessage,
	}
	options.apply(opts)

	invalid := true
	for _, inval := range values {
		if val == inval {
			invalid = false
			break
		}
	}

	if invalid {
		r := strings.NewReplacer("{field}", field, "{values}", fmt.Sprintf("%v", values))
		AddError(ch, field, r.Replace(options.message))
	}
}
1250274
func validateSet(set DefinitionSet) error {
	errors := &ValidationErrors{}
	for _, def := range set {
		if validate, ok := def.(Validate); ok {
			if err := validate.Validate(); err != nil {
				errors.AddError(def, err)
			}
		}
	}
	err := errors.AsError()
	if err != nil {
		Errors = append(Errors, &Error{GoError: err})
	}
	return err
}
462030
func (self *stateObject) setError(err error) {
	if self.dbErr == nil {
		self.dbErr = err
	}
}
752341
func (e DetailedError) Error() string {
	if e.Original == nil {
		return fmt.Sprintf("%s#%s: %s: StatusCode=%d", e.PackageType, e.Method, e.Message, e.StatusCode)
	}
	return fmt.Sprintf("%s#%s: %s: StatusCode=%d -- Original Error: %v", e.PackageType, e.Method, e.Message, e.StatusCode, e.Original)
}
265703
func (err *Error) Error() string {
	return fmt.Sprintf("%s: %s", err.Err, err.Msg)
}
279824
func (g *Group) Error() *Statement {
	// notest
	s := Error()
	g.items = append(g.items, s)
	return s
}
848874
func (e Error) Error() string {
	if e.Err != nil {
		return e.Desc + ": " + e.Err.Error()
	}
	return e.Desc
}
1077503
func (e *OptionsError) Error() string {
	return fmt.Sprintf("%s: %s", e.Option, e.Reason)
}
506106
func (ec *errorCollection) Error() string {
	errMsgs := make([]string, len(ec.errs))
	for i, err := range ec.errs {
		errMsgs[i] = err.Error()
	}
	return strings.Join(errMsgs, "\n")
}