github.com/swisscom/cloudfoundry-cli@v7.1.0+incompatible/api/cloudcontroller/ccerror/multi_error.go (about) 1 package ccerror 2 3 import ( 4 "fmt" 5 "strings" 6 ) 7 8 type MultiError struct { 9 Errors []V3Error 10 ResponseCode int 11 } 12 13 func (e MultiError) Details() []string { 14 var errorMsg []string 15 16 for _, err := range e.Errors { 17 errorMsg = append(errorMsg, err.Detail) 18 } 19 20 return errorMsg 21 } 22 23 func (e MultiError) Error() string { 24 errorMsg := []string{ 25 "Multiple errors occurred:", 26 fmt.Sprintf("Response Code: %d", e.ResponseCode), 27 } 28 29 for _, err := range e.Errors { 30 errorMsg = append(errorMsg, fmt.Sprintf("Code: %d, Title: %s, Detail: %s", err.Code, err.Title, err.Detail)) 31 } 32 33 return strings.Join(errorMsg, "\n") 34 }