github.com/khulnasoft-lab/defsec@v1.0.5-0.20230827010352-5e9f46893d95/pkg/errs/adapter.go (about) 1 package errs 2 3 import "strings" 4 5 type AdapterError struct { 6 errs []error 7 errorStrings []string 8 } 9 10 func NewAdapterError(errs []error) AdapterError { 11 12 var errorStrings []string 13 for _, err := range errs { 14 errorStrings = append(errorStrings, err.Error()) 15 } 16 17 return AdapterError{ 18 errs: errs, 19 errorStrings: errorStrings, 20 } 21 } 22 23 func (e *AdapterError) Errors() []error { 24 return e.errs 25 } 26 27 func (e AdapterError) Error() string { 28 return strings.Join(e.errorStrings, "\n") 29 }