mirror of https://github.com/go-gorm/gorm.git
Erros skip nil in Add function (#1566)
This commit is contained in:
parent
981d5db663
commit
6e456250f7
|
@ -29,6 +29,10 @@ func (errs Errors) GetErrors() []error {
|
||||||
// Add adds an error
|
// Add adds an error
|
||||||
func (errs Errors) Add(newErrors ...error) Errors {
|
func (errs Errors) Add(newErrors ...error) Errors {
|
||||||
for _, err := range newErrors {
|
for _, err := range newErrors {
|
||||||
|
if err == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
if errors, ok := err.(Errors); ok {
|
if errors, ok := err.(Errors); ok {
|
||||||
errs = errs.Add(errors...)
|
errs = errs.Add(errors...)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue