gitlab.com/evatix-go/core@v1.3.55/errcore/ManyErrorToSingle.go (about)

     1  package errcore
     2  
     3  func ManyErrorToSingle(errorItems []error) error {
     4  	if errorItems == nil || len(errorItems) == 0 {
     5  		return nil
     6  	}
     7  
     8  	sliceErr := make([]string, 0, len(errorItems))
     9  
    10  	for _, err := range errorItems {
    11  		if err == nil {
    12  			continue
    13  		}
    14  
    15  		sliceErr = append(sliceErr, err.Error())
    16  	}
    17  
    18  	return SliceToError(sliceErr)
    19  }