Fix AddError for DB

This commit is contained in:
Jinzhu 2016-11-09 10:22:42 +08:00
parent 9edd66250e
commit 53d09952be
1 changed files with 3 additions and 3 deletions

View File

@ -656,7 +656,7 @@ func (s *DB) AddError(err error) error {
}
errors := Errors(s.GetErrors())
errors.Add(err)
errors = errors.Add(err)
if len(errors) > 1 {
err = errors
}
@ -668,13 +668,13 @@ func (s *DB) AddError(err error) error {
}
// GetErrors get happened errors from the db
func (s *DB) GetErrors() (errors []error) {
func (s *DB) GetErrors() []error {
if errs, ok := s.Error.(Errors); ok {
return errs
} else if s.Error != nil {
return []error{s.Error}
}
return
return []error{}
}
////////////////////////////////////////////////////////////////////////////////