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

     1  package errcore
     2  
     3  import (
     4  	"errors"
     5  	"strings"
     6  
     7  	"gitlab.com/evatix-go/core/constants"
     8  )
     9  
    10  func SliceToErrorPtr(errorSlice *[]string) error {
    11  	if errorSlice == nil || len(*errorSlice) == 0 {
    12  		return nil
    13  	}
    14  
    15  	fullError := strings.Join(
    16  		*errorSlice,
    17  		constants.NewLineUnix)
    18  
    19  	return errors.New(fullError)
    20  }